summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRikard Falkeborn <rikard.falkeborn@gmail.com>2021-05-29 00:34:08 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-04 16:06:28 +0300
commit5a576764e4190f7b48cf3cf40f4294f001918605 (patch)
tree8467e31ccac33478f872e136bfe3757eea9ef670 /drivers
parent7f787701b2981d1a22f3951612fbb5a97ee658d3 (diff)
downloadlinux-5a576764e4190f7b48cf3cf40f4294f001918605.tar.xz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/cpu.c4
-rw-r--r--drivers/base/memory.c4
-rw-r--r--drivers/base/node.c2
-rw-r--r--drivers/base/platform.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 2b9e41377a07..5ef14db97904 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -175,7 +175,7 @@ static struct attribute *crash_note_cpu_attrs[] = {
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,
};
#endif
@@ -475,7 +475,7 @@ static struct attribute *cpu_root_attrs[] = {
NULL
};
-static struct attribute_group cpu_root_attr_group = {
+static const struct attribute_group cpu_root_attr_group = {
.attrs = cpu_root_attrs,
};
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index b31b3af5c490..600ae518c02a 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -596,7 +596,7 @@ static struct attribute *memory_memblk_attrs[] = {
NULL
};
-static struct attribute_group memory_memblk_attr_group = {
+static const struct attribute_group memory_memblk_attr_group = {
.attrs = memory_memblk_attrs,
};
@@ -772,7 +772,7 @@ static struct attribute *memory_root_attrs[] = {
NULL
};
-static struct attribute_group memory_root_attr_group = {
+static const struct attribute_group memory_root_attr_group = {
.attrs = memory_root_attrs,
};
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 6d0210357da3..c4202bbb8af2 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -1036,7 +1036,7 @@ static struct attribute *node_state_attrs[] = {
NULL
};
-static struct attribute_group memory_root_attr_group = {
+static const struct attribute_group memory_root_attr_group = {
.attrs = node_state_attrs,
};
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index ae071e8ed665..8640578f45e9 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1335,7 +1335,7 @@ static umode_t platform_dev_attrs_visible(struct kobject *kobj, struct attribute
return a->mode;
}
-static struct attribute_group platform_dev_group = {
+static const struct attribute_group platform_dev_group = {
.attrs = platform_dev_attrs,
.is_visible = platform_dev_attrs_visible,
};