diff mbox

[1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.

Message ID 1499770100-18632-2-git-send-email-arvind.yadav.cs@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Darren Hart
Headers show

Commit Message

Arvind Yadav July 11, 2017, 10:48 a.m. UTC
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(-)

Comments

Jonathan Woithe July 11, 2017, 11:14 a.m. UTC | #1
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
>  };
>  
> --
diff mbox

Patch

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
 };