linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: trigger: replace device_attr with device_attr_rw
@ 2018-01-04 10:58 Aishwarya Pant
  2018-01-06 12:27 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Aishwarya Pant @ 2018-01-04 10:58 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio, devel, linux-kernel
  Cc: Julia Lawall

This is a clean-up patch which replaces DEVICE_ATTR() macro with the
file permission specific DEVICE_ATTR_RW() macro for compaction and
readability. Done using coccinelle.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
 drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
index f389f5cca99d..71f11d7472c0 100644
--- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
+++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
@@ -78,9 +78,9 @@ static int iio_bfin_tmr_set_state(struct iio_trigger *trig, bool state)
 	return 0;
 }
 
-static ssize_t iio_bfin_tmr_frequency_store(struct device *dev,
-					    struct device_attribute *attr,
-					    const char *buf, size_t count)
+static ssize_t frequency_store(struct device *dev,
+			       struct device_attribute *attr,
+			       const char *buf, size_t count)
 {
 	struct iio_trigger *trig = to_iio_trigger(dev);
 	struct bfin_tmr_state *st = iio_trigger_get_drvdata(trig);
@@ -116,9 +116,9 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev,
 	return count;
 }
 
-static ssize_t iio_bfin_tmr_frequency_show(struct device *dev,
-					   struct device_attribute *attr,
-					   char *buf)
+static ssize_t frequency_show(struct device *dev,
+			      struct device_attribute *attr,
+			      char *buf)
 {
 	struct iio_trigger *trig = to_iio_trigger(dev);
 	struct bfin_tmr_state *st = iio_trigger_get_drvdata(trig);
@@ -133,8 +133,7 @@ static ssize_t iio_bfin_tmr_frequency_show(struct device *dev,
 	return sprintf(buf, "%lu\n", val);
 }
 
-static DEVICE_ATTR(frequency, 0644, iio_bfin_tmr_frequency_show,
-		   iio_bfin_tmr_frequency_store);
+static DEVICE_ATTR_RW(frequency);
 
 static struct attribute *iio_bfin_tmr_trigger_attrs[] = {
 	&dev_attr_frequency.attr,
-- 
2.15.1

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

* Re: [PATCH] staging: iio: trigger: replace device_attr with device_attr_rw
  2018-01-04 10:58 [PATCH] staging: iio: trigger: replace device_attr with device_attr_rw Aishwarya Pant
@ 2018-01-06 12:27 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2018-01-06 12:27 UTC (permalink / raw)
  To: Aishwarya Pant
  Cc: Lars-Peter Clausen, Michael Hennerich, Hartmut Knaack,
	Peter Meerwald-Stadler, Greg Kroah-Hartman, linux-iio, devel,
	linux-kernel, Julia Lawall

On Thu, 4 Jan 2018 16:28:51 +0530
Aishwarya Pant <aishpant@gmail.com> wrote:

> This is a clean-up patch which replaces DEVICE_ATTR() macro with the
> file permission specific DEVICE_ATTR_RW() macro for compaction and
> readability. Done using coccinelle.
> 
> Signed-off-by: Aishwarya Pant <aishpant@gmail.com>

Whilst this driver is in theory going away (Lars, update on that?)
I guess this is a minor improvement.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Also, note I changed the title to include the driver name as 
just putting to a directory is not much use for people trying
to track down changes that matter to them.

Jonathan

> ---
>  drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> index f389f5cca99d..71f11d7472c0 100644
> --- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> +++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> @@ -78,9 +78,9 @@ static int iio_bfin_tmr_set_state(struct iio_trigger *trig, bool state)
>  	return 0;
>  }
>  
> -static ssize_t iio_bfin_tmr_frequency_store(struct device *dev,
> -					    struct device_attribute *attr,
> -					    const char *buf, size_t count)
> +static ssize_t frequency_store(struct device *dev,
> +			       struct device_attribute *attr,
> +			       const char *buf, size_t count)
>  {
>  	struct iio_trigger *trig = to_iio_trigger(dev);
>  	struct bfin_tmr_state *st = iio_trigger_get_drvdata(trig);
> @@ -116,9 +116,9 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev,
>  	return count;
>  }
>  
> -static ssize_t iio_bfin_tmr_frequency_show(struct device *dev,
> -					   struct device_attribute *attr,
> -					   char *buf)
> +static ssize_t frequency_show(struct device *dev,
> +			      struct device_attribute *attr,
> +			      char *buf)
>  {
>  	struct iio_trigger *trig = to_iio_trigger(dev);
>  	struct bfin_tmr_state *st = iio_trigger_get_drvdata(trig);
> @@ -133,8 +133,7 @@ static ssize_t iio_bfin_tmr_frequency_show(struct device *dev,
>  	return sprintf(buf, "%lu\n", val);
>  }
>  
> -static DEVICE_ATTR(frequency, 0644, iio_bfin_tmr_frequency_show,
> -		   iio_bfin_tmr_frequency_store);
> +static DEVICE_ATTR_RW(frequency);
>  
>  static struct attribute *iio_bfin_tmr_trigger_attrs[] = {
>  	&dev_attr_frequency.attr,

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

end of thread, other threads:[~2018-01-06 12:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 10:58 [PATCH] staging: iio: trigger: replace device_attr with device_attr_rw Aishwarya Pant
2018-01-06 12:27 ` Jonathan Cameron

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).