Skip to content

Commit b98dd0b

Browse files
t-8chaxboe
authored andcommitted
bcache: 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 <[email protected]> Signed-off-by: Coly Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent a301b2d commit b98dd0b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/md/bcache/bcache.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,11 +1004,11 @@ extern struct workqueue_struct *bch_flush_wq;
10041004
extern struct mutex bch_register_lock;
10051005
extern struct list_head bch_cache_sets;
10061006

1007-
extern struct kobj_type bch_cached_dev_ktype;
1008-
extern struct kobj_type bch_flash_dev_ktype;
1009-
extern struct kobj_type bch_cache_set_ktype;
1010-
extern struct kobj_type bch_cache_set_internal_ktype;
1011-
extern struct kobj_type bch_cache_ktype;
1007+
extern const struct kobj_type bch_cached_dev_ktype;
1008+
extern const struct kobj_type bch_flash_dev_ktype;
1009+
extern const struct kobj_type bch_cache_set_ktype;
1010+
extern const struct kobj_type bch_cache_set_internal_ktype;
1011+
extern const struct kobj_type bch_cache_ktype;
10121012

10131013
void bch_cached_dev_release(struct kobject *kobj);
10141014
void bch_flash_dev_release(struct kobject *kobj);

drivers/md/bcache/sysfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define _BCACHE_SYSFS_H_
44

55
#define KTYPE(type) \
6-
struct kobj_type type ## _ktype = { \
6+
const struct kobj_type type ## _ktype = { \
77
.release = type ## _release, \
88
.sysfs_ops = &((const struct sysfs_ops) { \
99
.show = type ## _show, \

0 commit comments

Comments
 (0)