]> Git Repo - J-linux.git/commitdiff
cpuidle: sysfs: make kobj_type structures constant
authorThomas Weißschuh <[email protected]>
Tue, 7 Feb 2023 19:55:19 +0000 (19:55 +0000)
committerRafael J. Wysocki <[email protected]>
Thu, 9 Feb 2023 20:04:01 +0000 (21:04 +0100)
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 <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
drivers/cpuidle/sysfs.c

index 2b496a53cbca142d8dda29d7261c0efa5ad13537..48948b17174946fcfd21014eca39f0be6ac37da4 100644 (file)
@@ -200,7 +200,7 @@ static void cpuidle_sysfs_release(struct kobject *kobj)
        complete(&kdev->kobj_unregister);
 }
 
-static struct kobj_type ktype_cpuidle = {
+static const struct kobj_type ktype_cpuidle = {
        .sysfs_ops = &cpuidle_sysfs_ops,
        .release = cpuidle_sysfs_release,
 };
@@ -447,7 +447,7 @@ static void cpuidle_state_sysfs_release(struct kobject *kobj)
        complete(&state_obj->kobj_unregister);
 }
 
-static struct kobj_type ktype_state_cpuidle = {
+static const struct kobj_type ktype_state_cpuidle = {
        .sysfs_ops = &cpuidle_state_sysfs_ops,
        .default_groups = cpuidle_state_default_groups,
        .release = cpuidle_state_sysfs_release,
@@ -594,7 +594,7 @@ static struct attribute *cpuidle_driver_default_attrs[] = {
 };
 ATTRIBUTE_GROUPS(cpuidle_driver_default);
 
-static struct kobj_type ktype_driver_cpuidle = {
+static const struct kobj_type ktype_driver_cpuidle = {
        .sysfs_ops = &cpuidle_driver_sysfs_ops,
        .default_groups = cpuidle_driver_default_groups,
        .release = cpuidle_driver_sysfs_release,
This page took 0.049733 seconds and 4 git commands to generate.