Skip to content

Commit 3141e0e

Browse files
t-8chaxboe
authored andcommitted
blk-mq: make blk_mq_hw_ctx_sysfs_entry instances const
The blk_mq_hw_ctx_sysfs_entry structures are never modified, mark them as const. Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: John Garry <[email protected]> Link: https://patch.msgid.link/20260316-b4-sysfs-const-attr-block-v1-4-a35d73b986b0@weissschuh.net Signed-off-by: Jens Axboe <[email protected]>
1 parent f00d826 commit 3141e0e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

block/blk-mq-sysfs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static ssize_t blk_mq_hw_sysfs_show(struct kobject *kobj,
5353
struct request_queue *q;
5454
ssize_t res;
5555

56-
entry = container_of(attr, struct blk_mq_hw_ctx_sysfs_entry, attr);
56+
entry = container_of_const(attr, struct blk_mq_hw_ctx_sysfs_entry, attr);
5757
hctx = container_of(kobj, struct blk_mq_hw_ctx, kobj);
5858
q = hctx->queue;
5959

@@ -101,20 +101,20 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
101101
return pos + ret;
102102
}
103103

104-
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
104+
static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
105105
.attr = {.name = "nr_tags", .mode = 0444 },
106106
.show = blk_mq_hw_sysfs_nr_tags_show,
107107
};
108-
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = {
108+
static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = {
109109
.attr = {.name = "nr_reserved_tags", .mode = 0444 },
110110
.show = blk_mq_hw_sysfs_nr_reserved_tags_show,
111111
};
112-
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
112+
static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
113113
.attr = {.name = "cpu_list", .mode = 0444 },
114114
.show = blk_mq_hw_sysfs_cpus_show,
115115
};
116116

117-
static struct attribute *default_hw_ctx_attrs[] = {
117+
static const struct attribute *const default_hw_ctx_attrs[] = {
118118
&blk_mq_hw_sysfs_nr_tags.attr,
119119
&blk_mq_hw_sysfs_nr_reserved_tags.attr,
120120
&blk_mq_hw_sysfs_cpus.attr,

0 commit comments

Comments
 (0)