linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] PM / devfreq: governor: use DEVICE_ATTR_RW macro
@ 2021-05-24  2:11 YueHaibing
  2021-05-29  3:15 ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2021-05-24  2:11 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, cw00.choi, yuehaibing; +Cc: linux-pm, linux-kernel

Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/devfreq/governor_userspace.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c
index 0fd6c4851071..ab9db7adb3ad 100644
--- a/drivers/devfreq/governor_userspace.c
+++ b/drivers/devfreq/governor_userspace.c
@@ -31,8 +31,8 @@ static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq)
 	return 0;
 }
 
-static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
-			  const char *buf, size_t count)
+static ssize_t set_freq_store(struct device *dev, struct device_attribute *attr,
+			      const char *buf, size_t count)
 {
 	struct devfreq *devfreq = to_devfreq(dev);
 	struct userspace_data *data;
@@ -52,8 +52,8 @@ static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
 	return err;
 }
 
-static ssize_t show_freq(struct device *dev, struct device_attribute *attr,
-			 char *buf)
+static ssize_t set_freq_show(struct device *dev,
+			     struct device_attribute *attr, char *buf)
 {
 	struct devfreq *devfreq = to_devfreq(dev);
 	struct userspace_data *data;
@@ -70,7 +70,7 @@ static ssize_t show_freq(struct device *dev, struct device_attribute *attr,
 	return err;
 }
 
-static DEVICE_ATTR(set_freq, 0644, show_freq, store_freq);
+static DEVICE_ATTR_RW(set_freq);
 static struct attribute *dev_entries[] = {
 	&dev_attr_set_freq.attr,
 	NULL,
-- 
2.17.1


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

* Re: [PATCH -next] PM / devfreq: governor: use DEVICE_ATTR_RW macro
  2021-05-24  2:11 [PATCH -next] PM / devfreq: governor: use DEVICE_ATTR_RW macro YueHaibing
@ 2021-05-29  3:15 ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2021-05-29  3:15 UTC (permalink / raw)
  To: YueHaibing, myungjoo.ham, kyungmin.park, cw00.choi; +Cc: linux-pm, linux-kernel

On 21. 5. 24. 오전 11:11, YueHaibing wrote:
> Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR,
> which makes the code a bit shorter and easier to read.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>   drivers/devfreq/governor_userspace.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c
> index 0fd6c4851071..ab9db7adb3ad 100644
> --- a/drivers/devfreq/governor_userspace.c
> +++ b/drivers/devfreq/governor_userspace.c
> @@ -31,8 +31,8 @@ static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq)
>   	return 0;
>   }
>   
> -static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
> -			  const char *buf, size_t count)
> +static ssize_t set_freq_store(struct device *dev, struct device_attribute *attr,
> +			      const char *buf, size_t count)
>   {
>   	struct devfreq *devfreq = to_devfreq(dev);
>   	struct userspace_data *data;
> @@ -52,8 +52,8 @@ static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
>   	return err;
>   }
>   
> -static ssize_t show_freq(struct device *dev, struct device_attribute *attr,
> -			 char *buf)
> +static ssize_t set_freq_show(struct device *dev,
> +			     struct device_attribute *attr, char *buf)
>   {
>   	struct devfreq *devfreq = to_devfreq(dev);
>   	struct userspace_data *data;
> @@ -70,7 +70,7 @@ static ssize_t show_freq(struct device *dev, struct device_attribute *attr,
>   	return err;
>   }
>   
> -static DEVICE_ATTR(set_freq, 0644, show_freq, store_freq);
> +static DEVICE_ATTR_RW(set_freq);
>   static struct attribute *dev_entries[] = {
>   	&dev_attr_set_freq.attr,
>   	NULL,
> 

Applied it. Thanks.

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi

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

end of thread, other threads:[~2021-05-29  3:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  2:11 [PATCH -next] PM / devfreq: governor: use DEVICE_ATTR_RW macro YueHaibing
2021-05-29  3:15 ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).