All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpuidle: use default_groups in kobj_type
@ 2022-01-04 16:43 Greg Kroah-Hartman
  2022-01-06 17:26 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2022-01-04 16:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Daniel Lezcano, linux-pm

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" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/cpuidle/sysfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 469e18547d06..565ed005833a 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -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,
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpuidle: use default_groups in kobj_type
  2022-01-04 16:43 [PATCH] cpuidle: use default_groups in kobj_type Greg Kroah-Hartman
@ 2022-01-06 17:26 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-01-06 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Daniel Lezcano, Linux PM

On Tue, Jan 4, 2022 at 5:43 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> 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" <rafael@kernel.org>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/cpuidle/sysfs.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
> index 469e18547d06..565ed005833a 100644
> --- a/drivers/cpuidle/sysfs.c
> +++ b/drivers/cpuidle/sysfs.c
> @@ -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,
>  };
>
> --

Applied as 5.17 material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-06 17:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 16:43 [PATCH] cpuidle: use default_groups in kobj_type Greg Kroah-Hartman
2022-01-06 17:26 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.