diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2016-09-29 18:22:00 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-02 18:14:03 +0300 |
commit | c4610f6e1db2dd04119bcef80ab9dc12bff62117 (patch) | |
tree | 6fb3711f716a8970307e116203da72551d0d877b /drivers/staging | |
parent | 5f7688dd41e3d98b18792a961662387857dcd68e (diff) | |
download | linux-c4610f6e1db2dd04119bcef80ab9dc12bff62117.tar.xz |
Staging: speakup: 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
7551 1440 16 9007 232f
drivers/staging/speakup/kobjects.o
File size after:
text data bss dec hex filename
7671 1312 16 8999 2327
drivers/staging/speakup/kobjects.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/speakup/kobjects.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 4a78d377a78b..e744aa9730ff 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -976,11 +976,11 @@ static struct attribute *i18n_attrs[] = { * created for the attributes with the directory being the name of the * attribute group. */ -static struct attribute_group main_attr_group = { +static const struct attribute_group main_attr_group = { .attrs = main_attrs, }; -static struct attribute_group i18n_attr_group = { +static const struct attribute_group i18n_attr_group = { .attrs = i18n_attrs, .name = "i18n", }; |