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


Groups > linux.kernel > #1678528

Re: [PATCH] PM / sleep: constify attribute_group structures.

From Pavel Machek <pavel@ucw.cz>
Newsgroups linux.kernel
Subject Re: [PATCH] PM / sleep: constify attribute_group structures.
Date 2017-06-30 08:40 +0200
Message-ID <tXXKV-1TC-3@gated-at.bofh.it> (permalink)
References <tXWc9-KG-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri 2017-06-30 10:22:14, 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
>    3802	    624	     32	   4458	   116a	kernel/power/main.o
> 
> File size After adding 'const':
>    text	   data	    bss	    dec	    hex	filename
>    3866	    560	     32	   4458	   116a	kernel/power/main.o
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

Acked-by: Pavel Machek <pavel@ucw.cz>

> ---
>  kernel/power/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index d401c21..42bd800 100644
> --- a/kernel/power/main.c
> +++ b/kernel/power/main.c
> @@ -705,7 +705,7 @@ static ssize_t pm_freeze_timeout_store(struct kobject *kobj,
>  	NULL,
>  };
>  
> -static struct attribute_group attr_group = {
> +static const struct attribute_group attr_group = {
>  	.attrs = g,
>  };
>  

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] PM / sleep: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-06-30 07:00 +0200
  Re: [PATCH] PM / sleep: constify attribute_group structures. Pavel Machek <pavel@ucw.cz> - 2017-06-30 08:40 +0200

csiph-web