Skip to content

Commit 800f5aa

Browse files
kbrown9gregkh
authored andcommitted
block: Replace all ktype default_attrs with groups
The kobj_type default_attrs field is being replaced by the default_groups field. Replace all of the ktype default_attrs fields in the block subsystem with default_groups and use the ATTRIBUTE_GROUPS macro to create the default groups. Remove default_ctx_attrs[] because it doesn't contain any attributes. This patch was tested by verifying that the sysfs files for the attributes in the default groups were created. Signed-off-by: Kimberly Brown <kimbrownkd@gmail.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c484a67 commit 800f5aa

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎block/blk-integrity.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,15 @@ static struct attribute *integrity_attrs[] = {
365365
&integrity_device_entry.attr,
366366
NULL,
367367
};
368+
ATTRIBUTE_GROUPS(integrity);
368369

369370
static const struct sysfs_ops integrity_ops = {
370371
.show = &integrity_attr_show,
371372
.store = &integrity_attr_store,
372373
};
373374

374375
static struct kobj_type integrity_ktype = {
375-
.default_attrs = integrity_attrs,
376+
.default_groups = integrity_groups,
376377
.sysfs_ops = &integrity_ops,
377378
};
378379

‎block/blk-mq-sysfs.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
173173
return ret;
174174
}
175175

176-
static struct attribute *default_ctx_attrs[] = {
177-
NULL,
178-
};
179-
180176
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
181177
.attr = {.name = "nr_tags", .mode = 0444 },
182178
.show = blk_mq_hw_sysfs_nr_tags_show,
@@ -196,6 +192,7 @@ static struct attribute *default_hw_ctx_attrs[] = {
196192
&blk_mq_hw_sysfs_cpus.attr,
197193
NULL,
198194
};
195+
ATTRIBUTE_GROUPS(default_hw_ctx);
199196

200197
static const struct sysfs_ops blk_mq_sysfs_ops = {
201198
.show = blk_mq_sysfs_show,
@@ -214,13 +211,12 @@ static struct kobj_type blk_mq_ktype = {
214211

215212
static struct kobj_type blk_mq_ctx_ktype = {
216213
.sysfs_ops = &blk_mq_sysfs_ops,
217-
.default_attrs = default_ctx_attrs,
218214
.release = blk_mq_ctx_sysfs_release,
219215
};
220216

221217
static struct kobj_type blk_mq_hw_ktype = {
222218
.sysfs_ops = &blk_mq_hw_sysfs_ops,
223-
.default_attrs = default_hw_ctx_attrs,
219+
.default_groups = default_hw_ctx_groups,
224220
.release = blk_mq_hw_sysfs_release,
225221
};
226222

‎block/blk-sysfs.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ static struct attribute *default_attrs[] = {
769769
#endif
770770
NULL,
771771
};
772+
ATTRIBUTE_GROUPS(default);
772773

773774
#define to_queue(atr) container_of((atr), struct queue_sysfs_entry, attr)
774775

@@ -890,7 +891,7 @@ static const struct sysfs_ops queue_sysfs_ops = {
890891

891892
struct kobj_type blk_queue_ktype = {
892893
.sysfs_ops = &queue_sysfs_ops,
893-
.default_attrs = default_attrs,
894+
.default_groups = default_groups,
894895
.release = blk_release_queue,
895896
};
896897

0 commit comments

Comments
 (0)