Skip to content

Commit 862f6a8

Browse files
t-8chgregkh
authored andcommitted
samples/kobject: make kobj_type structure 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 definition to prevent modification at runtime. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c83d9ab commit 862f6a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

samples/kobject/kset-example.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ ATTRIBUTE_GROUPS(foo_default);
185185
* release function, and the set of default attributes we want created
186186
* whenever a kobject of this type is registered with the kernel.
187187
*/
188-
static struct kobj_type foo_ktype = {
188+
static const struct kobj_type foo_ktype = {
189189
.sysfs_ops = &foo_sysfs_ops,
190190
.release = foo_release,
191191
.default_groups = foo_default_groups,

0 commit comments

Comments
 (0)