All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: use default_groups in kobj_type
@ 2021-12-28 13:19 Greg Kroah-Hartman
  2021-12-28 18:14 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-12-28 13:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Viresh Kumar, 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 cpufreq 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: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/cpufreq/cpufreq.c              | 5 +++--
 drivers/cpufreq/cpufreq_conservative.c | 5 +++--
 drivers/cpufreq/cpufreq_ondemand.c     | 5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e338d2f010fe..09d676d5237e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -924,7 +924,7 @@ cpufreq_freq_attr_rw(scaling_max_freq);
 cpufreq_freq_attr_rw(scaling_governor);
 cpufreq_freq_attr_rw(scaling_setspeed);
 
-static struct attribute *default_attrs[] = {
+static struct attribute *cpufreq_attrs[] = {
 	&cpuinfo_min_freq.attr,
 	&cpuinfo_max_freq.attr,
 	&cpuinfo_transition_latency.attr,
@@ -938,6 +938,7 @@ static struct attribute *default_attrs[] = {
 	&scaling_setspeed.attr,
 	NULL
 };
+ATTRIBUTE_GROUPS(cpufreq);
 
 #define to_policy(k) container_of(k, struct cpufreq_policy, kobj)
 #define to_attr(a) container_of(a, struct freq_attr, attr)
@@ -1000,7 +1001,7 @@ static const struct sysfs_ops sysfs_ops = {
 
 static struct kobj_type ktype_cpufreq = {
 	.sysfs_ops	= &sysfs_ops,
-	.default_attrs	= default_attrs,
+	.default_groups	= cpufreq_groups,
 	.release	= cpufreq_sysfs_release,
 };
 
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 0879ec3c170c..08515f7e515f 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -257,7 +257,7 @@ gov_attr_rw(ignore_nice_load);
 gov_attr_rw(down_threshold);
 gov_attr_rw(freq_step);
 
-static struct attribute *cs_attributes[] = {
+static struct attribute *cs_attrs[] = {
 	&sampling_rate.attr,
 	&sampling_down_factor.attr,
 	&up_threshold.attr,
@@ -266,6 +266,7 @@ static struct attribute *cs_attributes[] = {
 	&freq_step.attr,
 	NULL
 };
+ATTRIBUTE_GROUPS(cs);
 
 /************************** sysfs end ************************/
 
@@ -315,7 +316,7 @@ static void cs_start(struct cpufreq_policy *policy)
 
 static struct dbs_governor cs_governor = {
 	.gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("conservative"),
-	.kobj_type = { .default_attrs = cs_attributes },
+	.kobj_type = { .default_groups = cs_groups },
 	.gov_dbs_update = cs_dbs_update,
 	.alloc = cs_alloc,
 	.free = cs_free,
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 3b8f924771b4..6a41ea4729b8 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -328,7 +328,7 @@ gov_attr_rw(sampling_down_factor);
 gov_attr_rw(ignore_nice_load);
 gov_attr_rw(powersave_bias);
 
-static struct attribute *od_attributes[] = {
+static struct attribute *od_attrs[] = {
 	&sampling_rate.attr,
 	&up_threshold.attr,
 	&sampling_down_factor.attr,
@@ -337,6 +337,7 @@ static struct attribute *od_attributes[] = {
 	&io_is_busy.attr,
 	NULL
 };
+ATTRIBUTE_GROUPS(od);
 
 /************************** sysfs end ************************/
 
@@ -401,7 +402,7 @@ static struct od_ops od_ops = {
 
 static struct dbs_governor od_dbs_gov = {
 	.gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("ondemand"),
-	.kobj_type = { .default_attrs = od_attributes },
+	.kobj_type = { .default_groups = od_groups },
 	.gov_dbs_update = od_dbs_update,
 	.alloc = od_alloc,
 	.free = od_free,
-- 
2.34.1


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

* Re: [PATCH] cpufreq: use default_groups in kobj_type
  2021-12-28 13:19 [PATCH] cpufreq: use default_groups in kobj_type Greg Kroah-Hartman
@ 2021-12-28 18:14 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2021-12-28 18:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Viresh Kumar, Linux PM

On Tue, Dec 28, 2021 at 2:19 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 cpufreq 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: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Applied as 5.17 material, thanks!

> ---
>  drivers/cpufreq/cpufreq.c              | 5 +++--
>  drivers/cpufreq/cpufreq_conservative.c | 5 +++--
>  drivers/cpufreq/cpufreq_ondemand.c     | 5 +++--
>  3 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index e338d2f010fe..09d676d5237e 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -924,7 +924,7 @@ cpufreq_freq_attr_rw(scaling_max_freq);
>  cpufreq_freq_attr_rw(scaling_governor);
>  cpufreq_freq_attr_rw(scaling_setspeed);
>
> -static struct attribute *default_attrs[] = {
> +static struct attribute *cpufreq_attrs[] = {
>         &cpuinfo_min_freq.attr,
>         &cpuinfo_max_freq.attr,
>         &cpuinfo_transition_latency.attr,
> @@ -938,6 +938,7 @@ static struct attribute *default_attrs[] = {
>         &scaling_setspeed.attr,
>         NULL
>  };
> +ATTRIBUTE_GROUPS(cpufreq);
>
>  #define to_policy(k) container_of(k, struct cpufreq_policy, kobj)
>  #define to_attr(a) container_of(a, struct freq_attr, attr)
> @@ -1000,7 +1001,7 @@ static const struct sysfs_ops sysfs_ops = {
>
>  static struct kobj_type ktype_cpufreq = {
>         .sysfs_ops      = &sysfs_ops,
> -       .default_attrs  = default_attrs,
> +       .default_groups = cpufreq_groups,
>         .release        = cpufreq_sysfs_release,
>  };
>
> diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
> index 0879ec3c170c..08515f7e515f 100644
> --- a/drivers/cpufreq/cpufreq_conservative.c
> +++ b/drivers/cpufreq/cpufreq_conservative.c
> @@ -257,7 +257,7 @@ gov_attr_rw(ignore_nice_load);
>  gov_attr_rw(down_threshold);
>  gov_attr_rw(freq_step);
>
> -static struct attribute *cs_attributes[] = {
> +static struct attribute *cs_attrs[] = {
>         &sampling_rate.attr,
>         &sampling_down_factor.attr,
>         &up_threshold.attr,
> @@ -266,6 +266,7 @@ static struct attribute *cs_attributes[] = {
>         &freq_step.attr,
>         NULL
>  };
> +ATTRIBUTE_GROUPS(cs);
>
>  /************************** sysfs end ************************/
>
> @@ -315,7 +316,7 @@ static void cs_start(struct cpufreq_policy *policy)
>
>  static struct dbs_governor cs_governor = {
>         .gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("conservative"),
> -       .kobj_type = { .default_attrs = cs_attributes },
> +       .kobj_type = { .default_groups = cs_groups },
>         .gov_dbs_update = cs_dbs_update,
>         .alloc = cs_alloc,
>         .free = cs_free,
> diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
> index 3b8f924771b4..6a41ea4729b8 100644
> --- a/drivers/cpufreq/cpufreq_ondemand.c
> +++ b/drivers/cpufreq/cpufreq_ondemand.c
> @@ -328,7 +328,7 @@ gov_attr_rw(sampling_down_factor);
>  gov_attr_rw(ignore_nice_load);
>  gov_attr_rw(powersave_bias);
>
> -static struct attribute *od_attributes[] = {
> +static struct attribute *od_attrs[] = {
>         &sampling_rate.attr,
>         &up_threshold.attr,
>         &sampling_down_factor.attr,
> @@ -337,6 +337,7 @@ static struct attribute *od_attributes[] = {
>         &io_is_busy.attr,
>         NULL
>  };
> +ATTRIBUTE_GROUPS(od);
>
>  /************************** sysfs end ************************/
>
> @@ -401,7 +402,7 @@ static struct od_ops od_ops = {
>
>  static struct dbs_governor od_dbs_gov = {
>         .gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("ondemand"),
> -       .kobj_type = { .default_attrs = od_attributes },
> +       .kobj_type = { .default_groups = od_groups },
>         .gov_dbs_update = od_dbs_update,
>         .alloc = od_alloc,
>         .free = od_free,
> --
> 2.34.1
>

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

end of thread, other threads:[~2021-12-28 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 13:19 [PATCH] cpufreq: use default_groups in kobj_type Greg Kroah-Hartman
2021-12-28 18:14 ` 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.