ACPI: sysfs: use default_groups in kobj_type
PATCH 1/1 ACPI: sysfs: 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 ACPI 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.
--- drivers/acpi/cppc_acpi.c | 3 ++- drivers/acpi/device_sysfs.c | 3 ++- drivers/acpi/sysfs.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/acpi/cppc_acpi.c +2 -1
@@ -179,10 +179,11 @@ static struct attribute *cppc_attrs[] = { &lowest_freq.attr, NULL }; +ATTRIBUTE_GROUPS (cppc);static struct kobj_type cppc_ktype = { .sysfs_ops = &kobj_sysfs_ops, - .default_attrs = cppc_attrs, + .default_groups = cppc_groups, };static int check_pcc_chan (int pcc_ss_id,bool chk_err_bit)
drivers/acpi/device_sysfs.c +2 -1
@@ -53,6 +53,7 @@ static struct attribute *acpi_data_node_default_attrs[] = { &data_node_path.attr, NULL }; +ATTRIBUTE_GROUPS (acpi_data_node_default);#define to_data_node (k) container_of(k, struct acpi_data_node, kobj)#define to_attr (a) container_of(a, struct acpi_data_node_attr, attr)
@@ -79,7 +80,7 @@ static void acpi_data_node_release(struct kobject *kobj)static struct kobj_type acpi_data_node_ktype = { .sysfs_ops = &acpi_data_node_sysfs_ops, - .default_attrs = acpi_data_node_default_attrs, + .default_groups = acpi_data_node_default_groups, .release = acpi_data_node_release, };
drivers/acpi/sysfs.c +2 -1
@@ -939,10 +939,11 @@ static struct attribute *hotplug_profile_attrs[] = { &hotplug_enabled_attr.attr,NULL }; +ATTRIBUTE_GROUPS (hotplug_profile);static struct kobj_type acpi_hotplug_profile_ktype = { .sysfs_ops = &kobj_sysfs_ops, - .default_attrs = hotplug_profile_attrs, + .default_groups = hotplug_profile_groups, }; void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
Signature · 1 line
2.34.1
Quoted 8 lines · Greg Kroah-Hartman
There are currently 2 ways to create a set of sysfs files for a
kobj_type, through thedefault_attrsfield, and thedefault_groupsfield. Move the ACPI sysfs code to usedefault_groupsfield which has been the preferred way sinceaa30f47cf666("kobject: Add support for default attribute groups tokobj_type") so that we can soon get rid of the obsoletedefault_attrsfield.
Quoted 4 lines
Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Applied as 5.17 material, thanks!
Quoted 64 lines
--- drivers/acpi/cppc_acpi.c | 3 ++- drivers/acpi/device_sysfs.c | 3 ++- drivers/acpi/sysfs.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-)drivers/acpi/cppc_acpi.c +2
-1@@ -179,10 +179,11 @@ static struct attribute *cppc_attrs[] = { &lowest_freq.attr, NULL }; +ATTRIBUTE_GROUPS (cppc);static struct kobj_type cppc_ktype = { .sysfs_ops = &kobj_sysfs_ops, - .default_attrs = cppc_attrs, + .default_groups = cppc_groups, };static int check_pcc_chan (int pcc_ss_id,bool chk_err_bit)drivers/acpi/device_sysfs.c +2
-1@@ -53,6 +53,7 @@ static struct attribute *acpi_data_node_default_attrs[] = { &data_node_path.attr, NULL }; +ATTRIBUTE_GROUPS (acpi_data_node_default);#define to_data_node (k) container_of(k, struct acpi_data_node, kobj)#define to_attr (a) container_of(a, struct acpi_data_node_attr, attr)@@ -79,7 +80,7 @@ static void acpi_data_node_release(struct kobject *kobj)static struct kobj_type acpi_data_node_ktype = { .sysfs_ops = &acpi_data_node_sysfs_ops, - .default_attrs = acpi_data_node_default_attrs, + .default_groups = acpi_data_node_default_groups, .release = acpi_data_node_release, };drivers/acpi/sysfs.c +2
-2@@ -939,10 +939,11 @@ static struct attribute *hotplug_profile_attrs[] = { &hotplug_enabled_attr.attr,NULL }; +ATTRIBUTE_GROUPS (hotplug_profile);static struct kobj_type acpi_hotplug_profile_ktype = { .sysfs_ops = &kobj_sysfs_ops, - .default_attrs = hotplug_profile_attrs, + .default_groups = hotplug_profile_groups, }; void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, --2.34.1