PM: Constify static struct attribute_group
Subsystems (2)
PATCH 1/1 PM: Constify static struct attribute_group
The only usage of suspend_attr_group is to put its address in an array of pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory.
Signed-off-by Rikard Falkeborn <[email protected]>
--- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/main.c +1 -1
@@ -387,7 +387,7 @@ static struct attribute *suspend_attrs[] = { NULL, }; -static struct attribute_group suspend_attr_group = { +static const struct attribute_group suspend_attr_group = { .name ="suspend_stats" , .attrs = suspend_attrs, };
Signature · 1 line
2.30.0
Quoted 15 lines · Rikard Falkeborn
The only usage of
suspend_attr_groupis to put its address in an array of pointers to constattribute_groupstructs. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>--- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/power/main.c +0
-0
kernel/power/main.c static struct attribute *suspend_attrs[] = {
Quoted 9 lines
kernel/power/main.c +1
-2@@ -387,7 +387,7 @@ static struct attribute *suspend_attrs[] = { NULL, }; -static struct attribute_group suspend_attr_group = { +static const struct attribute_group suspend_attr_group = { .name ="suspend_stats" , .attrs = suspend_attrs, }; --
Applied as 5.12 material, thanks!