samples/kobject: make kobj_type structure constant

Message ID 20230208-kobj_type-samples-v1-1-fca804a8e9f3@weissschuh.net
State New
Headers
Series samples/kobject: make kobj_type structure constant |

Commit Message

Thomas Weißschuh Feb. 8, 2023, 3:54 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 definition to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 samples/kobject/kset-example.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb
change-id: 20230208-kobj_type-samples-19e709195c63

Best regards,
  

Patch

diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c
index 52f1acabd479..342452282719 100644
--- a/samples/kobject/kset-example.c
+++ b/samples/kobject/kset-example.c
@@ -185,7 +185,7 @@  ATTRIBUTE_GROUPS(foo_default);
  * release function, and the set of default attributes we want created
  * whenever a kobject of this type is registered with the kernel.
  */
-static struct kobj_type foo_ktype = {
+static const struct kobj_type foo_ktype = {
 	.sysfs_ops = &foo_sysfs_ops,
 	.release = foo_release,
 	.default_groups = foo_default_groups,