drivers/base: Constify static attribute_group structs

These are only used by putting their address in an array of pointers to
const struct attribute_group (either directly or via the
__ATTRIBUTE_GROUP macro). Make them const to allow the compiler to place
them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210528213408.20067-1-rikard.falkeborn@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Rikard Falkeborn
2021-05-28 23:34:08 +02:00
committed by Greg Kroah-Hartman
parent 7f787701b2
commit 5a576764e4
4 changed files with 6 additions and 6 deletions

View File

@@ -175,7 +175,7 @@ static struct attribute *crash_note_cpu_attrs[] = {
NULL NULL
}; };
static struct attribute_group crash_note_cpu_attr_group = { static const struct attribute_group crash_note_cpu_attr_group = {
.attrs = crash_note_cpu_attrs, .attrs = crash_note_cpu_attrs,
}; };
#endif #endif
@@ -475,7 +475,7 @@ static struct attribute *cpu_root_attrs[] = {
NULL NULL
}; };
static struct attribute_group cpu_root_attr_group = { static const struct attribute_group cpu_root_attr_group = {
.attrs = cpu_root_attrs, .attrs = cpu_root_attrs,
}; };

View File

@@ -596,7 +596,7 @@ static struct attribute *memory_memblk_attrs[] = {
NULL NULL
}; };
static struct attribute_group memory_memblk_attr_group = { static const struct attribute_group memory_memblk_attr_group = {
.attrs = memory_memblk_attrs, .attrs = memory_memblk_attrs,
}; };
@@ -772,7 +772,7 @@ static struct attribute *memory_root_attrs[] = {
NULL NULL
}; };
static struct attribute_group memory_root_attr_group = { static const struct attribute_group memory_root_attr_group = {
.attrs = memory_root_attrs, .attrs = memory_root_attrs,
}; };

View File

@@ -1036,7 +1036,7 @@ static struct attribute *node_state_attrs[] = {
NULL NULL
}; };
static struct attribute_group memory_root_attr_group = { static const struct attribute_group memory_root_attr_group = {
.attrs = node_state_attrs, .attrs = node_state_attrs,
}; };

View File

@@ -1335,7 +1335,7 @@ static umode_t platform_dev_attrs_visible(struct kobject *kobj, struct attribute
return a->mode; return a->mode;
} }
static struct attribute_group platform_dev_group = { static const struct attribute_group platform_dev_group = {
.attrs = platform_dev_attrs, .attrs = platform_dev_attrs,
.is_visible = platform_dev_attrs_visible, .is_visible = platform_dev_attrs_visible,
}; };