Skip to contentSkip to conversation

cpuidle: use default_groups in kobj_type

PATCH Applied Greg Kroah-Hartman 2 participants 2 messages Jan 4, 2022 – Jan 6, 2022 CPU idle time management framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuidle: use default_groups in kobj_type

There are currently 2 ways to create a set of sysfs files for a kobj_type, through the default_attrs field, and the default_groups field. Move the cpuidle sysfs code to use default_groups field which has been the preferred way since aa30f47cf666 ("kobject: Add support for default attribute groups to kobj_type") so that we can soon get rid of the obsolete default_attrs field.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Daniel Lezcano <[email protected]>
---
 drivers/cpuidle/sysfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpuidle/sysfs.c +4 -2
index 469e18547d06..565ed005833a 100644
@@ -335,6 +335,7 @@ static struct attribute *cpuidle_state_default_attrs[] = {
 	&attr_default_status.attr,
 	NULL
 };
+ATTRIBUTE_GROUPS(cpuidle_state_default);
 
 struct cpuidle_state_kobj {
 	struct cpuidle_state *state;
@@ -448,7 +449,7 @@ static void cpuidle_state_sysfs_release(struct kobject *kobj)
 
 static struct kobj_type ktype_state_cpuidle = {
 	.sysfs_ops = &cpuidle_state_sysfs_ops,
-	.default_attrs = cpuidle_state_default_attrs,
+	.default_groups = cpuidle_state_default_groups,
 	.release = cpuidle_state_sysfs_release,
 };
 
@@ -591,10 +592,11 @@ static struct attribute *cpuidle_driver_default_attrs[] = {
 	&attr_driver_name.attr,
 	NULL
 };
+ATTRIBUTE_GROUPS(cpuidle_driver_default);
 
 static struct kobj_type ktype_driver_cpuidle = {
 	.sysfs_ops = &cpuidle_driver_sysfs_ops,
-	.default_attrs = cpuidle_driver_default_attrs,
+	.default_groups = cpuidle_driver_default_groups,
 	.release = cpuidle_driver_sysfs_release,
 };
 
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 41 lines · Greg Kroah-Hartman

There are currently 2 ways to create a set of sysfs files for a kobj_type, through the default_attrs field, and the default_groups field. Move the cpuidle sysfs code to use default_groups field which has been the preferred way since aa30f47cf666 ("kobject: Add support for default attribute groups to kobj_type") so that we can soon get rid of the obsolete default_attrs field.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Daniel Lezcano <[email protected]>
---
 drivers/cpuidle/sysfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpuidle/sysfs.c +2 -1
index 469e18547d06..565ed005833a 100644
@@ -335,6 +335,7 @@ static struct attribute *cpuidle_state_default_attrs[] = {
        &attr_default_status.attr,
        NULL
 };
+ATTRIBUTE_GROUPS(cpuidle_state_default);
 
 struct cpuidle_state_kobj {
        struct cpuidle_state *state;
@@ -448,7 +449,7 @@ static void cpuidle_state_sysfs_release(struct kobject *kobj)
 
 static struct kobj_type ktype_state_cpuidle = {
        .sysfs_ops = &cpuidle_state_sysfs_ops,
-       .default_attrs = cpuidle_state_default_attrs,
+       .default_groups = cpuidle_state_default_groups,
        .release = cpuidle_state_sysfs_release,
 };
 
@@ -591,10 +592,11 @@ static struct attribute *cpuidle_driver_default_attrs[] = {
        &attr_driver_name.attr,
        NULL
 };

drivers/cpuidle/sysfs.c static struct attribute *cpuidle_driver_default_attrs[] = {

Quoted 10 lines
drivers/cpuidle/sysfs.c +2 -2
+ATTRIBUTE_GROUPS(cpuidle_driver_default);
 
 static struct kobj_type ktype_driver_cpuidle = {
        .sysfs_ops = &cpuidle_driver_sysfs_ops,
-       .default_attrs = cpuidle_driver_default_attrs,
+       .default_groups = cpuidle_driver_default_groups,
        .release = cpuidle_driver_sysfs_release,
 };
 
--

Applied as 5.17 material, thanks!