All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: wmi: declare device_type structure as constant
@ 2018-10-28  6:07 Bhumika Goyal
  2018-10-29 13:49 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2018-10-28  6:07 UTC (permalink / raw)
  To: dvhart, andy, platform-driver-x86, linux-kernel
  Cc: julia.lawall, Bhumika Goyal

The only usage of device_type structure is getting stored as
a reference in the type field of device structure. This type
field is declared const. Therefore, the device_type structure
can never be modified and can be declared as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/platform/x86/wmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 04791ea5d97b..bea35be68706 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -987,19 +987,19 @@ static struct bus_type wmi_bus_type = {
 	.remove = wmi_dev_remove,
 };
 
-static struct device_type wmi_type_event = {
+static const struct device_type wmi_type_event = {
 	.name = "event",
 	.groups = wmi_event_groups,
 	.release = wmi_dev_release,
 };
 
-static struct device_type wmi_type_method = {
+static const struct device_type wmi_type_method = {
 	.name = "method",
 	.groups = wmi_method_groups,
 	.release = wmi_dev_release,
 };
 
-static struct device_type wmi_type_data = {
+static const struct device_type wmi_type_data = {
 	.name = "data",
 	.groups = wmi_data_groups,
 	.release = wmi_dev_release,
-- 
2.14.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: wmi: declare device_type structure as constant
  2018-10-28  6:07 [PATCH] platform/x86: wmi: declare device_type structure as constant Bhumika Goyal
@ 2018-10-29 13:49 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2018-10-29 13:49 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Julia Lawall

On Sun, Oct 28, 2018 at 8:07 AM Bhumika Goyal <bhumirks@gmail.com> wrote:
>
> The only usage of device_type structure is getting stored as
> a reference in the type field of device structure. This type
> field is declared const. Therefore, the device_type structure
> can never be modified and can be declared as const.
>

Pushed to my review and testing queue, thanks!

> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/platform/x86/wmi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 04791ea5d97b..bea35be68706 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -987,19 +987,19 @@ static struct bus_type wmi_bus_type = {
>         .remove = wmi_dev_remove,
>  };
>
> -static struct device_type wmi_type_event = {
> +static const struct device_type wmi_type_event = {
>         .name = "event",
>         .groups = wmi_event_groups,
>         .release = wmi_dev_release,
>  };
>
> -static struct device_type wmi_type_method = {
> +static const struct device_type wmi_type_method = {
>         .name = "method",
>         .groups = wmi_method_groups,
>         .release = wmi_dev_release,
>  };
>
> -static struct device_type wmi_type_data = {
> +static const struct device_type wmi_type_data = {
>         .name = "data",
>         .groups = wmi_data_groups,
>         .release = wmi_dev_release,
> --
> 2.14.5
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-29 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-28  6:07 [PATCH] platform/x86: wmi: declare device_type structure as constant Bhumika Goyal
2018-10-29 13:49 ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.