block: Constify static attribute_group structs
PATCH 1/1 block: Constify static attribute_group structs
Either their address is put in an array of pointers to const attribute groups structs, or the address is passed to sysfs_create_group() which accepts a pointer to const struct attribute group. Make them const to allow the compiler to put them in read-only memory.
Signed-off-by Rikard Falkeborn <[email protected]>
--- block/blk-sysfs.c | 2 +- block/genhd.c | 2 +- block/partitions/core.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
block/blk-sysfs.c +1 -1
@@ -698,7 +698,7 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,return attr->mode; } -static struct attribute_group queue_attr_group = { +static const struct attribute_group queue_attr_group = { .attrs = queue_attrs, .is_visible = queue_attr_visible, };
block/genhd.c +1 -1
@@ -1090,7 +1090,7 @@ static umode_t disk_visible(struct kobject *kobj, struct attribute *a, int n)return a->mode; } -static struct attribute_group disk_attr_group = { +static const struct attribute_group disk_attr_group = { .attrs = disk_attrs, .is_visible = disk_visible, };
block/partitions/core.c +1 -1
@@ -246,7 +246,7 @@ static struct attribute *part_attrs[] = { NULL }; -static struct attribute_group part_attr_group = { +static const struct attribute_group part_attr_group = { .attrs = part_attrs, };
Signature · 1 line
2.31.1