All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: hibernate: constify attribute_group structures.
@ 2017-06-29 11:28 Arvind Yadav
  2017-06-29 11:59 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2017-06-29 11:28 UTC (permalink / raw)
  To: rjw, len.brown, pavel; +Cc: linux-pm, linux-kernel

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
   6332	    488	    308	   7128	   1bd8	kernel/power/hibernate.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   6396	    424	    308	   7128	   1bd8	kernel/power/hibernate.o

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

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index a8b978c..e1914c7 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -1108,7 +1108,7 @@ static ssize_t reserved_size_store(struct kobject *kobj,
 };
 
 
-static struct attribute_group attr_group = {
+static const struct attribute_group attr_group = {
 	.attrs = g,
 };
 
-- 
1.9.1

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

* Re: [PATCH] PM: hibernate: constify attribute_group structures.
  2017-06-29 11:28 [PATCH] PM: hibernate: constify attribute_group structures Arvind Yadav
@ 2017-06-29 11:59 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2017-06-29 11:59 UTC (permalink / raw)
  To: Arvind Yadav; +Cc: rjw, len.brown, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

On Thu 2017-06-29 16:58:40, 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
>    6332	    488	    308	   7128	   1bd8	kernel/power/hibernate.o
> 
> File size After adding 'const':
>    text	   data	    bss	    dec	    hex	filename
>    6396	    424	    308	   7128	   1bd8	kernel/power/hibernate.o
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

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


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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

end of thread, other threads:[~2017-06-29 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 11:28 [PATCH] PM: hibernate: constify attribute_group structures Arvind Yadav
2017-06-29 11:59 ` Pavel Machek

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.