Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1684951 > unrolled thread

[PATCH 0/7] Constify platform/x86 attribute_group structures.

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-07-11 12:50 +0200
Last post2017-07-11 18:30 +0200
Articles 10 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/7] Constify platform/x86 attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 12:50 +0200
    [PATCH 2/7] platform/x86: compal-laptop: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 12:50 +0200
    [PATCH 4/7] platform/x86: alienware-wmi: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 12:50 +0200
    [PATCH 3/7] platform/x86: samsung-laptop: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 12:50 +0200
    [PATCH 6/7] platform/x86: asus-wmi: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 12:50 +0200
    [PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 12:50 +0200
      Re: [PATCH 1/7] platform/x86: fujitsu-laptop: constify  attribute_group structures. Jonathan Woithe <jwoithe@just42.net> - 2017-07-11 13:20 +0200
    [PATCH 7/7] platform/x86: toshiba_acpi: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 12:50 +0200
    [PATCH 5/7] platform/x86: panasonic-laptop: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-11 13:00 +0200
    Re: [PATCH 0/7] Constify platform/x86 attribute_group structures. Darren Hart <dvhart@infradead.org> - 2017-07-11 18:30 +0200

#1684951 — [PATCH 0/7] Constify platform/x86 attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 12:50 +0200
Subject[PATCH 0/7] Constify platform/x86 attribute_group structures.
Message-ID<u20TT-1c3-1@gated-at.bofh.it>
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

Arvind Yadav (7):
  [PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.
  [PATCH 2/7] platform/x86: compal-laptop: constify attribute_group structures.
  [PATCH 3/7] platform/x86: samsung-laptop: constify attribute_group structures.
  [PATCH 4/7] platform/x86: alienware-wmi: constify attribute_group structures.
  [PATCH 5/7] platform/x86: panasonic-laptop: constify attribute_group structures.
  [PATCH 6/7] platform/x86: asus-wmi: constify attribute_group structures.
  [PATCH 7/7] platform/x86: toshiba_acpi: constify attribute_group structures.

 drivers/platform/x86/alienware-wmi.c    | 6 +++---
 drivers/platform/x86/asus-wmi.c         | 4 ++--
 drivers/platform/x86/compal-laptop.c    | 2 +-
 drivers/platform/x86/fujitsu-laptop.c   | 2 +-
 drivers/platform/x86/panasonic-laptop.c | 2 +-
 drivers/platform/x86/samsung-laptop.c   | 2 +-
 drivers/platform/x86/toshiba_acpi.c     | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1684952 — [PATCH 2/7] platform/x86: compal-laptop: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 12:50 +0200
Subject[PATCH 2/7] platform/x86: compal-laptop: constify attribute_group structures.
Message-ID<u20TU-1c3-5@gated-at.bofh.it>
In reply to#1684951
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   6781	   6144	     34	  12959	   329f	drivers/platform/x86/compal-laptop.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   6845	   6080	     34	  12959	   329f	drivers/platform/x86/compal-laptop.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/platform/x86/compal-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index e1c2b6d..a8e4a53 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -718,7 +718,7 @@ static DEVICE_ATTR(pwm1_enable,
 	&dev_attr_wake_up_mouse.attr,
 	NULL
 };
-static struct attribute_group compal_platform_attr_group = {
+static const struct attribute_group compal_platform_attr_group = {
 	.attrs = compal_platform_attrs
 };
 
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1684953 — [PATCH 4/7] platform/x86: alienware-wmi: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 12:50 +0200
Subject[PATCH 4/7] platform/x86: alienware-wmi: constify attribute_group structures.
Message-ID<u20TU-1c3-7@gated-at.bofh.it>
In reply to#1684951
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   6932	   1016	     48	   7996	   1f3c	drivers/platform/x86/alienware-wmi.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   7060	    888	     48	   7996	   1f64	drivers/platform/x86/alienware-wmi.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/platform/x86/alienware-wmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
index 9866fec..0831b42 100644
--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -604,7 +604,7 @@ static DEVICE_ATTR(source, S_IRUGO | S_IWUSR, show_hdmi_source,
 	NULL,
 };
 
-static struct attribute_group hdmi_attribute_group = {
+static const struct attribute_group hdmi_attribute_group = {
 	.name = "hdmi",
 	.attrs = hdmi_attrs,
 };
@@ -660,7 +660,7 @@ static ssize_t show_amplifier_status(struct device *dev,
 	NULL,
 };
 
-static struct attribute_group amplifier_attribute_group = {
+static const struct attribute_group amplifier_attribute_group = {
 	.name = "amplifier",
 	.attrs = amplifier_attrs,
 };
@@ -741,7 +741,7 @@ static ssize_t toggle_deepsleep(struct device *dev,
 	NULL,
 };
 
-static struct attribute_group deepsleep_attribute_group = {
+static const struct attribute_group deepsleep_attribute_group = {
 	.name = "deepsleep",
 	.attrs = deepsleep_attrs,
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1684954 — [PATCH 3/7] platform/x86: samsung-laptop: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 12:50 +0200
Subject[PATCH 3/7] platform/x86: samsung-laptop: constify attribute_group structures.
Message-ID<u20TU-1c3-9@gated-at.bofh.it>
In reply to#1684951
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   8710	   5452	     23	  14185	   3769	drivers/platform/x86/samsung-laptop.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   8774	   5388	     23	  14185	   3769	drivers/platform/x86/samsung-laptop.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/platform/x86/samsung-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 5c4dfe4..0c703fe 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1232,7 +1232,7 @@ static umode_t samsung_sysfs_is_visible(struct kobject *kobj,
 	return ok ? attr->mode : 0;
 }
 
-static struct attribute_group platform_attribute_group = {
+static const struct attribute_group platform_attribute_group = {
 	.is_visible = samsung_sysfs_is_visible,
 	.attrs = platform_attributes
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1684955 — [PATCH 6/7] platform/x86: asus-wmi: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 12:50 +0200
Subject[PATCH 6/7] platform/x86: asus-wmi: constify attribute_group structures.
Message-ID<u20TU-1c3-11@gated-at.bofh.it>
In reply to#1684951
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  13140	    840	      1	  13981	   369d	drivers/platform/x86/asus-wmi.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  13268	    712	      1	  13981	   368d	drivers/platform/x86/asus-wmi.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/platform/x86/asus-wmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 6c7d860..709e3a6 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1433,7 +1433,7 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
 	return ok ? attr->mode : 0;
 }
 
-static struct attribute_group hwmon_attribute_group = {
+static const struct attribute_group hwmon_attribute_group = {
 	.is_visible = asus_hwmon_sysfs_is_visible,
 	.attrs = hwmon_attributes
 };
@@ -1821,7 +1821,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
 	return ok ? attr->mode : 0;
 }
 
-static struct attribute_group platform_attribute_group = {
+static const struct attribute_group platform_attribute_group = {
 	.is_visible = asus_sysfs_is_visible,
 	.attrs = platform_attributes
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1684956 — [PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 12:50 +0200
Subject[PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.
Message-ID<u20TU-1c3-17@gated-at.bofh.it>
In reply to#1684951
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   7474	   1205	     24	   8703	   21ff	drivers/platform/x86/fujitsu-laptop.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   7538	   1141	     24	   8703	   21ff	drivers/platform/x86/fujitsu-laptop.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/platform/x86/fujitsu-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index c1a8528..7973342 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -317,7 +317,7 @@ static ssize_t radios_show(struct device *dev, struct device_attribute *attr,
 	NULL
 };
 
-static struct attribute_group fujitsu_pf_attribute_group = {
+static const struct attribute_group fujitsu_pf_attribute_group = {
 	.attrs = fujitsu_pf_attributes
 };
 
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1684978 — Re: [PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.

FromJonathan Woithe <jwoithe@just42.net>
Date2017-07-11 13:20 +0200
SubjectRe: [PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.
Message-ID<u21mV-1BA-11@gated-at.bofh.it>
In reply to#1684956
On Tue, Jul 11, 2017 at 04:18:14PM +0530, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
> 
> File size before:
>    text	   data	    bss	    dec	    hex	filename
>    7474	   1205	     24	   8703	   21ff	drivers/platform/x86/fujitsu-laptop.o
> 
> File size After adding 'const':
>    text	   data	    bss	    dec	    hex	filename
>    7538	   1141	     24	   8703	   21ff	drivers/platform/x86/fujitsu-laptop.o
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

I have no objections to this patch - it seems like the sensible thing to do
in the interests of remaining consistent with the rest of the kernel. 
Thanks Arvind.

Reviewed-by: Jonathan Woithe <jwoithe@just42.net>

Regards
  jonathan

> ---
>  drivers/platform/x86/fujitsu-laptop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index c1a8528..7973342 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -317,7 +317,7 @@ static ssize_t radios_show(struct device *dev, struct device_attribute *attr,
>  	NULL
>  };
>  
> -static struct attribute_group fujitsu_pf_attribute_group = {
> +static const struct attribute_group fujitsu_pf_attribute_group = {
>  	.attrs = fujitsu_pf_attributes
>  };
>  
> -- 

[toc] | [prev] | [next] | [standalone]


#1684957 — [PATCH 7/7] platform/x86: toshiba_acpi: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 12:50 +0200
Subject[PATCH 7/7] platform/x86: toshiba_acpi: constify attribute_group structures.
Message-ID<u20TU-1c3-13@gated-at.bofh.it>
In reply to#1684951
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  26360	   1072	     24	  27456	   6b40	drivers/platform/x86/toshiba_acpi.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  26424	   1008	     24	  27456	   6b40	drivers/platform/x86/toshiba_acpi.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/platform/x86/toshiba_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 88f9f79..bb1dcd7 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -2419,7 +2419,7 @@ static umode_t toshiba_sysfs_is_visible(struct kobject *kobj,
 	return exists ? attr->mode : 0;
 }
 
-static struct attribute_group toshiba_attr_group = {
+static const struct attribute_group toshiba_attr_group = {
 	.is_visible = toshiba_sysfs_is_visible,
 	.attrs = toshiba_attributes,
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1684959 — [PATCH 5/7] platform/x86: panasonic-laptop: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-11 13:00 +0200
Subject[PATCH 5/7] platform/x86: panasonic-laptop: constify attribute_group structures.
Message-ID<u213z-1g3-1@gated-at.bofh.it>
In reply to#1684951
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   2505	    600	      4	   3109	    c25	drivers/platform/x86/panasonic-laptop.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   2569	    536	      4	   3109	    c25	drivers/platform/x86/panasonic-laptop.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 76b0a58..5c39b32 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -437,7 +437,7 @@ static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,
 	NULL,
 };
 
-static struct attribute_group pcc_attr_group = {
+static const struct attribute_group pcc_attr_group = {
 	.name	= NULL,		/* put in device directory */
 	.attrs	= pcc_sysfs_entries,
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1685193

FromDarren Hart <dvhart@infradead.org>
Date2017-07-11 18:30 +0200
Message-ID<u26cV-4Ed-11@gated-at.bofh.it>
In reply to#1684951
On Tue, Jul 11, 2017 at 04:18:13PM +0530, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.

Build tested, no warnings/errors found. Queued to testing, thanks Arvind.

> 
> Arvind Yadav (7):
>   [PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.
>   [PATCH 2/7] platform/x86: compal-laptop: constify attribute_group structures.
>   [PATCH 3/7] platform/x86: samsung-laptop: constify attribute_group structures.
>   [PATCH 4/7] platform/x86: alienware-wmi: constify attribute_group structures.
>   [PATCH 5/7] platform/x86: panasonic-laptop: constify attribute_group structures.
>   [PATCH 6/7] platform/x86: asus-wmi: constify attribute_group structures.
>   [PATCH 7/7] platform/x86: toshiba_acpi: constify attribute_group structures.
> 
>  drivers/platform/x86/alienware-wmi.c    | 6 +++---
>  drivers/platform/x86/asus-wmi.c         | 4 ++--
>  drivers/platform/x86/compal-laptop.c    | 2 +-
>  drivers/platform/x86/fujitsu-laptop.c   | 2 +-
>  drivers/platform/x86/panasonic-laptop.c | 2 +-
>  drivers/platform/x86/samsung-laptop.c   | 2 +-
>  drivers/platform/x86/toshiba_acpi.c     | 2 +-
>  7 files changed, 10 insertions(+), 10 deletions(-)
> 
> -- 
> 1.9.1
> 
> 

-- 
Darren Hart
VMware Open Source Technology Center

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web