diff options
author | Christoph Hellwig <hch@lst.de> | 2022-06-28 19:18:47 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-28 11:32:42 -0600 |
commit | 4a8d14bba486cca6880062f1ef240cf1d45f3367 (patch) | |
tree | df965b0c71300243cc58673dd3cdad2259fd7122 /block/blk-sysfs.c | |
parent | 060f131e9c438837f9792e456fae424e621fb881 (diff) | |
download | lwn-4a8d14bba486cca6880062f1ef240cf1d45f3367.tar.gz lwn-4a8d14bba486cca6880062f1ef240cf1d45f3367.zip |
block: use default groups to register the queue attributes
Set up the default_groups for blk_queue_ktype instead of manually calling
sysfs_create_group.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220628171850.1313069-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r-- | block/blk-sysfs.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index f9373da591b8..b72506770b97 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -795,7 +795,13 @@ static const struct sysfs_ops queue_sysfs_ops = { .store = queue_attr_store, }; +static const struct attribute_group *blk_queue_attr_groups[] = { + &queue_attr_group, + NULL +}; + struct kobj_type blk_queue_ktype = { + .default_groups = blk_queue_attr_groups, .sysfs_ops = &queue_sysfs_ops, .release = blk_release_queue, }; @@ -816,12 +822,6 @@ int blk_register_queue(struct gendisk *disk) if (ret < 0) goto unlock; - ret = sysfs_create_group(&q->kobj, &queue_attr_group); - if (ret) { - kobject_del(&q->kobj); - goto unlock; - } - if (queue_is_mq(q)) __blk_mq_register_dev(dev, q); mutex_lock(&q->sysfs_lock); |