Linux EDAC development
 help / color / mirror / Atom feed
* edac: constify attribute_group structures.
@ 2017-07-17  8:23 Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2017-07-17  8:23 UTC (permalink / raw)
  To: Arvind Yadav; +Cc: mchehab, linux-edac, linux-kernel

On Mon, Jul 03, 2017 at 04:09:33PM +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
>    6026	   2541	     12	   8579	   2183	drivers/edac/edac_mc_sysfs.o
> 
> File size After adding 'const':
>    text	   data	    bss	    dec	    hex	filename
>    6090	   2477	     12	   8579	   2183	drivers/edac/edac_mc_sysfs.o

What is that before/after thing supposed to tell me exactly?

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

Anyway, I've merged your two EDAC patches into one and applied it.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread
* edac: constify attribute_group structures.
@ 2017-07-03 10:39 Arvind Yadav
  0 siblings, 0 replies; 2+ messages in thread
From: Arvind Yadav @ 2017-07-03 10:39 UTC (permalink / raw)
  To: mchehab, bp; +Cc: linux-edac, 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
   6026	   2541	     12	   8579	   2183	drivers/edac/edac_mc_sysfs.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   6090	   2477	     12	   8579	   2183	drivers/edac/edac_mc_sysfs.o

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

diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 445862d..dbc6446 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -287,7 +287,7 @@ static ssize_t channel_ce_count_show(struct device *dev,
 	NULL,
 };
 
-static struct attribute_group csrow_attr_grp = {
+static const struct attribute_group csrow_attr_grp = {
 	.attrs	= csrow_attrs,
 };
 
@@ -627,7 +627,7 @@ static DEVICE_ATTR(dimm_label, S_IRUGO | S_IWUSR,
 	NULL,
 };
 
-static struct attribute_group dimm_attr_grp = {
+static const struct attribute_group dimm_attr_grp = {
 	.attrs	= dimm_attrs,
 };
 
@@ -902,7 +902,7 @@ static umode_t mci_attr_is_visible(struct kobject *kobj,
 	return mode;
 }
 
-static struct attribute_group mci_attr_grp = {
+static const struct attribute_group mci_attr_grp = {
 	.attrs	= mci_attrs,
 	.is_visible = mci_attr_is_visible,
 };

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

end of thread, other threads:[~2017-07-17  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-17  8:23 edac: constify attribute_group structures Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2017-07-03 10:39 Arvind Yadav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox