From: Rikard Falkeborn <rikard.falkeborn@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Hannes Reinecke <hare@suse.de>, Jan Kara <jack@suse.cz>,
Ming Lei <ming.lei@redhat.com>,
Damien Le Moal <damien.lemoal@wdc.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Rikard Falkeborn <rikard.falkeborn@gmail.com>
Subject: [PATCH] block: Constify static attribute_group structs
Date: Sat, 29 May 2021 00:32:52 +0200 [thread overview]
Message-ID: <20210528223252.29343-1-rikard.falkeborn@gmail.com> (raw)
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 <rikard.falkeborn@gmail.com>
---
block/blk-sysfs.c | 2 +-
block/genhd.c | 2 +-
block/partitions/core.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index f89e2fc3963b..5c5d21b7d278 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -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,
};
diff --git a/block/genhd.c b/block/genhd.c
index 9f8cb7beaad1..0f85687a7c69 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -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,
};
diff --git a/block/partitions/core.c b/block/partitions/core.c
index dc60ecf46fe6..8c3237f11261 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -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,
};
--
2.31.1
reply other threads:[~2021-05-28 22:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210528223252.29343-1-rikard.falkeborn@gmail.com \
--to=rikard.falkeborn@gmail.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=hare@suse.de \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).