Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpuidle: sysfs: make kobj_type structures constant

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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Thomas Weißschuh and committed by
Rafael J. Wysocki
e898b07d 7787943a

+3 -3
+3 -3
drivers/cpuidle/sysfs.c
··· 200 200 complete(&kdev->kobj_unregister); 201 201 } 202 202 203 - static struct kobj_type ktype_cpuidle = { 203 + static const struct kobj_type ktype_cpuidle = { 204 204 .sysfs_ops = &cpuidle_sysfs_ops, 205 205 .release = cpuidle_sysfs_release, 206 206 }; ··· 447 447 complete(&state_obj->kobj_unregister); 448 448 } 449 449 450 - static struct kobj_type ktype_state_cpuidle = { 450 + static const struct kobj_type ktype_state_cpuidle = { 451 451 .sysfs_ops = &cpuidle_state_sysfs_ops, 452 452 .default_groups = cpuidle_state_default_groups, 453 453 .release = cpuidle_state_sysfs_release, ··· 594 594 }; 595 595 ATTRIBUTE_GROUPS(cpuidle_driver_default); 596 596 597 - static struct kobj_type ktype_driver_cpuidle = { 597 + static const struct kobj_type ktype_driver_cpuidle = { 598 598 .sysfs_ops = &cpuidle_driver_sysfs_ops, 599 599 .default_groups = cpuidle_driver_default_groups, 600 600 .release = cpuidle_driver_sysfs_release,