Commit c4610f6e authored by Bhumika Goyal's avatar Bhumika Goyal Committed by Greg Kroah-Hartman
Browse files

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 = {...};

identifier r1.i;
position p;
expression e1;

position p!={r1.p,ok1.p};
identifier r1.i;

@depends on !bad disable optional_qualifier@
identifier r1.i;
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
struct attribute_group i;

File size before:
   text	   data	    bss	    dec	    hex	filename
   7551	   1440	     16	   9007	   232f

File size after:
   text	   data	    bss	    dec	    hex	filename
   7671	   1312	     16	   8999	   2327

Signed-off-by: default avatarBhumika Goyal <>
Acked-by: default avatarSamuel Thibault <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 5f7688dd
......@@ -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",
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment