2023-02-14 03:21:03

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH] dm sysfs: make kobj_type structure constant

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definition to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
drivers/md/dm-sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-sysfs.c b/drivers/md/dm-sysfs.c
index e28c92478536..dc281162f1d4 100644
--- a/drivers/md/dm-sysfs.c
+++ b/drivers/md/dm-sysfs.c
@@ -119,7 +119,7 @@ static const struct sysfs_ops dm_sysfs_ops = {
.store = dm_attr_store,
};

-static struct kobj_type dm_ktype = {
+static const struct kobj_type dm_ktype = {
.sysfs_ops = &dm_sysfs_ops,
.default_groups = dm_groups,
.release = dm_kobject_release,

---
base-commit: f6feea56f66d34259c4222fa02e8171c4f2673d1
change-id: 20230214-kobj_type-dm-66ebe1e40530

Best regards,
--
Thomas Weißschuh <[email protected]>