diff mbox series

chardev: make kobj_type structures constant

Message ID 20230216-kobj_type-chardev-v1-1-94e213b73e85@weissschuh.net (mailing list archive)
State New, archived
Headers show
Series chardev: make kobj_type structures constant | expand

Commit Message

Thomas Weißschuh Feb. 16, 2023, 1:14 a.m. UTC
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 definitions to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 fs/char_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


---
base-commit: 033c40a89f55525139fd5b6342281b09b97d05bf
change-id: 20230216-kobj_type-chardev-f0d84e96be2e

Best regards,
diff mbox series

Patch

diff --git a/fs/char_dev.c b/fs/char_dev.c
index 13deb45f1ec6..b33331cb97cd 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -624,11 +624,11 @@  static void cdev_dynamic_release(struct kobject *kobj)
 	kobject_put(parent);
 }
 
-static struct kobj_type ktype_cdev_default = {
+static const struct kobj_type ktype_cdev_default = {
 	.release	= cdev_default_release,
 };
 
-static struct kobj_type ktype_cdev_dynamic = {
+static const struct kobj_type ktype_cdev_dynamic = {
 	.release	= cdev_dynamic_release,
 };