Commit 4a8d14bb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220628171850.1313069-4-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 060f131e
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment