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 <linux@weissschuh.net> Reviewed-by: John Garry <john.g.garry@oracle.com> Link: https://patch.msgid.link/20260316-b4-sysfs-const-attr-block-v1-4-a35d73b986b0@weissschuh.net Signed-off-by: Jens Axboe <axboe@kernel.dk>master
parent
f00d826f1b
commit
3141e0e536
|
|
@ -53,7 +53,7 @@ static ssize_t blk_mq_hw_sysfs_show(struct kobject *kobj,
|
||||||
struct request_queue *q;
|
struct request_queue *q;
|
||||||
ssize_t res;
|
ssize_t res;
|
||||||
|
|
||||||
entry = container_of(attr, struct blk_mq_hw_ctx_sysfs_entry, attr);
|
entry = container_of_const(attr, struct blk_mq_hw_ctx_sysfs_entry, attr);
|
||||||
hctx = container_of(kobj, struct blk_mq_hw_ctx, kobj);
|
hctx = container_of(kobj, struct blk_mq_hw_ctx, kobj);
|
||||||
q = hctx->queue;
|
q = hctx->queue;
|
||||||
|
|
||||||
|
|
@ -101,20 +101,20 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
|
||||||
return pos + ret;
|
return pos + ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
|
static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
|
||||||
.attr = {.name = "nr_tags", .mode = 0444 },
|
.attr = {.name = "nr_tags", .mode = 0444 },
|
||||||
.show = blk_mq_hw_sysfs_nr_tags_show,
|
.show = blk_mq_hw_sysfs_nr_tags_show,
|
||||||
};
|
};
|
||||||
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = {
|
static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = {
|
||||||
.attr = {.name = "nr_reserved_tags", .mode = 0444 },
|
.attr = {.name = "nr_reserved_tags", .mode = 0444 },
|
||||||
.show = blk_mq_hw_sysfs_nr_reserved_tags_show,
|
.show = blk_mq_hw_sysfs_nr_reserved_tags_show,
|
||||||
};
|
};
|
||||||
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
|
static const struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
|
||||||
.attr = {.name = "cpu_list", .mode = 0444 },
|
.attr = {.name = "cpu_list", .mode = 0444 },
|
||||||
.show = blk_mq_hw_sysfs_cpus_show,
|
.show = blk_mq_hw_sysfs_cpus_show,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct attribute *default_hw_ctx_attrs[] = {
|
static const struct attribute *const default_hw_ctx_attrs[] = {
|
||||||
&blk_mq_hw_sysfs_nr_tags.attr,
|
&blk_mq_hw_sysfs_nr_tags.attr,
|
||||||
&blk_mq_hw_sysfs_nr_reserved_tags.attr,
|
&blk_mq_hw_sysfs_nr_reserved_tags.attr,
|
||||||
&blk_mq_hw_sysfs_cpus.attr,
|
&blk_mq_hw_sysfs_cpus.attr,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue