diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2016-09-29 20:18:54 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-02 17:24:00 +0200 |
commit | 7b346dac731361d45ef173f66df3a6509fd3b865 (patch) | |
tree | ceddad2e6727f46835e8dbd1e7755f40940f731d /drivers | |
parent | d983c597757883496a9e4956e308395f8ac53bf0 (diff) | |
download | talos-obmc-linux-7b346dac731361d45ef173f66df3a6509fd3b865.tar.gz talos-obmc-linux-7b346dac731361d45ef173f66df3a6509fd3b865.zip |
Staging: dgnc: constify attribute_group structures
Check for attribute_group structures that are only passed as a second
argument to the functions sysfs_remove_group and sysfs_create_group. As
these arguments are constant so, attribute_group structures having this
property can also be made constant.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
expression e1;
@@
(
sysfs_remove_group(e1,&i@p)
|
sysfs_create_group(e1,&i@p)
)
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;
File size before:
text data bss dec hex filename
6248 1024 0 7272 1c68
drivers/staging/dgnc/dgnc_sysfs.o
File size after:
text data bss dec hex filename
6288 960 0 7248 1c50
drivers/staging/dgnc/dgnc_sysfs.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/dgnc/dgnc_sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index a83e0e4ea75f..290bf6e226ac 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -677,7 +677,7 @@ static struct attribute *dgnc_sysfs_tty_entries[] = { NULL }; -static struct attribute_group dgnc_tty_attribute_group = { +static const struct attribute_group dgnc_tty_attribute_group = { .name = NULL, .attrs = dgnc_sysfs_tty_entries, }; |