diff mbox series

[2/2] cpufreq: use helper macro __ATTR_XX

Message ID 20220306021250.64315-2-zhanglianjie@uniontech.com
State New
Headers show
Series [1/2] cpufreq: unify the show() and store() styles of attr | expand

Commit Message

Lianjie Zhang March 6, 2022, 2:12 a.m. UTC
Use helper macro __ATTR_XX  to make code more clear.
Minor readability improvement.

Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>

--
2.20.1

Comments

Viresh Kumar March 7, 2022, 5:44 a.m. UTC | #1
On 06-03-22, 10:12, zhanglianjie wrote:
> Use helper macro __ATTR_XX  to make code more clear.
> Minor readability improvement.
> 
> Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>
> 
> diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
> index 65ecf32ba4f8..a5a0bc3cc23e 100644
> --- a/drivers/cpufreq/cpufreq_governor.h
> +++ b/drivers/cpufreq/cpufreq_governor.h
> @@ -68,12 +68,10 @@ static ssize_t file_name##_show						\
>  }
> 
>  #define gov_attr_ro(_name)						\
> -static struct governor_attr _name =					\
> -__ATTR(_name, 0444, _name##_show, NULL)
> +static struct governor_attr _name = __ATTR_RO(_name)
> 
>  #define gov_attr_rw(_name)						\
> -static struct governor_attr _name =					\
> -__ATTR(_name, 0644, _name##_show, _name##_store)
> +static struct governor_attr _name = __ATTR_RW(_name)
> 
>  /* Common to all CPUs of a policy */
>  struct policy_dbs_info {

This change looks fine though.
diff mbox series

Patch

diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 65ecf32ba4f8..a5a0bc3cc23e 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -68,12 +68,10 @@  static ssize_t file_name##_show						\
 }

 #define gov_attr_ro(_name)						\
-static struct governor_attr _name =					\
-__ATTR(_name, 0444, _name##_show, NULL)
+static struct governor_attr _name = __ATTR_RO(_name)

 #define gov_attr_rw(_name)						\
-static struct governor_attr _name =					\
-__ATTR(_name, 0644, _name##_show, _name##_store)
+static struct governor_attr _name = __ATTR_RW(_name)

 /* Common to all CPUs of a policy */
 struct policy_dbs_info {