Skip to content

Commit

Permalink
f2fs: make kobj_type structures constant
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Thomas Weißschuh authored and Jaegeuk Kim committed Feb 13, 2023
1 parent 269d119 commit 273a51e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/f2fs/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,21 +1162,21 @@ static const struct sysfs_ops f2fs_attr_ops = {
.store = f2fs_attr_store,
};

static struct kobj_type f2fs_sb_ktype = {
static const struct kobj_type f2fs_sb_ktype = {
.default_groups = f2fs_groups,
.sysfs_ops = &f2fs_attr_ops,
.release = f2fs_sb_release,
};

static struct kobj_type f2fs_ktype = {
static const struct kobj_type f2fs_ktype = {
.sysfs_ops = &f2fs_attr_ops,
};

static struct kset f2fs_kset = {
.kobj = {.ktype = &f2fs_ktype},
};

static struct kobj_type f2fs_feat_ktype = {
static const struct kobj_type f2fs_feat_ktype = {
.default_groups = f2fs_feat_groups,
.sysfs_ops = &f2fs_attr_ops,
};
Expand Down Expand Up @@ -1217,7 +1217,7 @@ static const struct sysfs_ops f2fs_stat_attr_ops = {
.store = f2fs_stat_attr_store,
};

static struct kobj_type f2fs_stat_ktype = {
static const struct kobj_type f2fs_stat_ktype = {
.default_groups = f2fs_stat_groups,
.sysfs_ops = &f2fs_stat_attr_ops,
.release = f2fs_stat_kobj_release,
Expand All @@ -1244,7 +1244,7 @@ static const struct sysfs_ops f2fs_feature_list_attr_ops = {
.show = f2fs_sb_feat_attr_show,
};

static struct kobj_type f2fs_feature_list_ktype = {
static const struct kobj_type f2fs_feature_list_ktype = {
.default_groups = f2fs_sb_feat_groups,
.sysfs_ops = &f2fs_feature_list_attr_ops,
.release = f2fs_feature_list_kobj_release,
Expand Down

0 comments on commit 273a51e

Please sign in to comment.