Skip to contentSkip to conversation

staging: unisys: visorbus_main: constify attribute_group structures

PATCH In review Amitoj Kaur Chawla 2 participants 2 messages Jul 25, 2017 – Jul 28, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: unisys: visorbus_main: constify attribute_group structures

Functions working with attribute_groups provided by <linux/device.h> work with const attribute_group. These attribute_group structures do not change at runtime so mark them as const.

File size before:

 text     data     bss     dec     hex filename
 14216    7304     832   22352    5750

drivers/staging/unisys/visorbus/visorbus_main.o

File size after:

 text     data     bss     dec     hex filename
 14408    7112     832   22352    5750

drivers/staging/unisys/visorbus/visorbus_main.o

This change was made with the help of Coccinelle.

---
 drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/unisys/visorbus/visorbus_main.c +2 -2
index 1c785dd..bba10dc 100644
@@ -249,7 +249,7 @@ static struct attribute *channel_attrs[] = {
 		NULL
 };
 
-static struct attribute_group channel_attr_grp = {
+static const struct attribute_group channel_attr_grp = {
 		.name = "channel",
 		.attrs = channel_attrs,
 };
@@ -340,7 +340,7 @@ static struct attribute *dev_attrs[] = {
 		NULL
 };
 
-static struct attribute_group dev_attr_grp = {
+static const struct attribute_group dev_attr_grp = {
 		.attrs = dev_attrs,
 };
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 35 lines · Amitoj Kaur Chawla

Functions working with attribute_groups provided by <linux/device.h> work with const attribute_group. These attribute_group structures do not change at runtime so mark them as const.

File size before:

 text     data     bss     dec     hex filename
 14216    7304     832   22352    5750

drivers/staging/unisys/visorbus/visorbus_main.o

File size after:

 text     data     bss     dec     hex filename
 14408    7112     832   22352    5750

drivers/staging/unisys/visorbus/visorbus_main.o

This change was made with the help of Coccinelle.

---
 drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/unisys/visorbus/visorbus_main.c +1 -1
index 1c785dd..bba10dc 100644
@@ -249,7 +249,7 @@ static struct attribute *channel_attrs[] = {
 		NULL
 };
 
-static struct attribute_group channel_attr_grp = {
+static const struct attribute_group channel_attr_grp = {
 		.name = "channel",
 		.attrs = channel_attrs,
 };

drivers/staging/unisys/visorbus/visorbus_main.c static struct attribute *dev_attrs[] = { · line 346

Quoted 8 lines
drivers/staging/unisys/visorbus/visorbus_main.c +1 -1
@@ -340,7 +340,7 @@ static struct attribute *dev_attrs[] = {
 		NULL
 };
 
-static struct attribute_group dev_attr_grp = {
+static const struct attribute_group dev_attr_grp = {
 		.attrs = dev_attrs,
 };
 

Does not apply to my tree :(

sorry,

greg k-h