Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Thomas Weißschuh and committed by
Jens Axboe
3141e0e5 f00d826f

+5 -5
+5 -5
block/blk-mq-sysfs.c
··· 53 53 struct request_queue *q; 54 54 ssize_t res; 55 55 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); 57 57 hctx = container_of(kobj, struct blk_mq_hw_ctx, kobj); 58 58 q = hctx->queue; 59 59 ··· 101 101 return pos + ret; 102 102 } 103 103 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 = { 105 105 .attr = {.name = "nr_tags", .mode = 0444 }, 106 106 .show = blk_mq_hw_sysfs_nr_tags_show, 107 107 }; 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 = { 109 109 .attr = {.name = "nr_reserved_tags", .mode = 0444 }, 110 110 .show = blk_mq_hw_sysfs_nr_reserved_tags_show, 111 111 }; 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 = { 113 113 .attr = {.name = "cpu_list", .mode = 0444 }, 114 114 .show = blk_mq_hw_sysfs_cpus_show, 115 115 }; 116 116 117 - static struct attribute *default_hw_ctx_attrs[] = { 117 + static const struct attribute *const default_hw_ctx_attrs[] = { 118 118 &blk_mq_hw_sysfs_nr_tags.attr, 119 119 &blk_mq_hw_sysfs_nr_reserved_tags.attr, 120 120 &blk_mq_hw_sysfs_cpus.attr,