[PATCH] samples/kobject: make kobj_type structure constant

From: Thomas Weißschuh
Date: Tue Feb 07 2023 - 22:55:16 EST


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@xxxxxxxxxxxxxx>
---
samples/kobject/kset-example.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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,

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

Best regards,
--
Thomas Weißschuh <linux@xxxxxxxxxxxxxx>