Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: constify attribute_group structures.

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/device.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
9968 3168 16 13152 3360 net/core/net-sysfs.o

File size After adding 'const':
text data bss dec hex filename
10160 2976 16 13152 3360 net/core/net-sysfs.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arvind Yadav and committed by
David S. Miller
38ef00cc ee27244b

+3 -3
+3 -3
net/core/net-sysfs.c
··· 626 626 }; 627 627 628 628 629 - static struct attribute_group netstat_group = { 629 + static const struct attribute_group netstat_group = { 630 630 .name = "statistics", 631 631 .attrs = netstat_attrs, 632 632 }; ··· 636 636 NULL 637 637 }; 638 638 639 - static struct attribute_group wireless_group = { 639 + static const struct attribute_group wireless_group = { 640 640 .name = "wireless", 641 641 .attrs = wireless_attrs, 642 642 }; ··· 1204 1204 NULL 1205 1205 }; 1206 1206 1207 - static struct attribute_group dql_group = { 1207 + static const struct attribute_group dql_group = { 1208 1208 .name = "byte_queue_limits", 1209 1209 .attrs = dql_attrs, 1210 1210 };