Skip to content

Commit 4d72a9d

Browse files
t-8chliu-song-6
authored andcommitted
md: make kobj_type structures constant
Since commit ee6d3dd ("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 definitions to prevent modification at runtime. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230214-kobj_type-md-v1-1-d6853f707f11@weissschuh.net
1 parent a405c6f commit 4d72a9d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/md/md.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
static LIST_HEAD(pers_list);
7979
static DEFINE_SPINLOCK(pers_lock);
8080

81-
static struct kobj_type md_ktype;
81+
static const struct kobj_type md_ktype;
8282

8383
struct md_cluster_operations *md_cluster_ops;
8484
EXPORT_SYMBOL(md_cluster_ops);
@@ -3597,7 +3597,7 @@ static const struct sysfs_ops rdev_sysfs_ops = {
35973597
.show = rdev_attr_show,
35983598
.store = rdev_attr_store,
35993599
};
3600-
static struct kobj_type rdev_ktype = {
3600+
static const struct kobj_type rdev_ktype = {
36013601
.release = rdev_free,
36023602
.sysfs_ops = &rdev_sysfs_ops,
36033603
.default_groups = rdev_default_groups,
@@ -5555,7 +5555,7 @@ static const struct sysfs_ops md_sysfs_ops = {
55555555
.show = md_attr_show,
55565556
.store = md_attr_store,
55575557
};
5558-
static struct kobj_type md_ktype = {
5558+
static const struct kobj_type md_ktype = {
55595559
.release = md_kobj_release,
55605560
.sysfs_ops = &md_sysfs_ops,
55615561
.default_groups = md_attr_groups,

0 commit comments

Comments
 (0)