public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] iio: use permission specific variants of DEVICE_ATTR
@ 2018-01-04 14:36 Aishwarya Pant
  2018-01-04 14:37 ` [PATCH 1/5] iio: buffer: " Aishwarya Pant
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Aishwarya Pant @ 2018-01-04 14:36 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel
  Cc: Julia Lawall, Joe Perches

Series of clean-up patches which replace all DEVICE_ATTR macros with the
permission specific variants DEVICE_ATTR_{RO/WO/RW}.

Patches were created using coccinelle. The following script is for conversion to
the DEVICE_ATTR_RO macro and the other conversions are similar. The script may
require some manual intervention when multiple attributes share the show or
store function.

@r@
identifier attr, show_fn;
declarer name DEVICE_ATTR;
@@

DEVICE_ATTR(attr, \(S_IRUGO\|0444\), show_fn, NULL);

@script: python p@
attr_show;
attr << r.attr;
@@

// standardise the show fn name to {attr}_show
coccinelle.attr_show = attr + "_show"

@@
identifier r.attr, r.show_fn;
declarer name DEVICE_ATTR_RO;
@@

// change the attr declaration
- DEVICE_ATTR(attr, \(S_IRUGO\|0444\), show_fn, NULL);
+ DEVICE_ATTR_RO(attr);

@rr@
identifier r.show_fn, p.attr_show;
@@

// rename the show function
- show_fn
+ attr_show
        (...) {
        ...
  }

@depends on rr@
identifier r.show_fn, p.attr_show;
@@

// rename fn usages
- show_fun
+ attr_show

Aishwarya Pant (5):
  iio: buffer: use permission specific variants of DEVICE_ATTR
  iio: core: use permission specific variants of DEVICE_ATTR
  iio: trigger: use permission specific variants of DEVICE_ATTR
  iio: hrtimer: use permission specific variants of DEVICE_ATTR
  iio: trigger: sysfs: use permisssion specific variants of DEVICE_ATTR

 drivers/iio/industrialio-buffer.c      | 25 +++++++++++--------------
 drivers/iio/industrialio-core.c        | 11 +++++------
 drivers/iio/industrialio-trigger.c     | 18 ++++++++----------
 drivers/iio/trigger/iio-trig-hrtimer.c |  8 +++-----
 drivers/iio/trigger/iio-trig-sysfs.c   |  4 ++--
 5 files changed, 29 insertions(+), 37 deletions(-)

-- 
2.15.1

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

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

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 14:36 [PATCH 0/5] iio: use permission specific variants of DEVICE_ATTR Aishwarya Pant
2018-01-04 14:37 ` [PATCH 1/5] iio: buffer: " Aishwarya Pant
2018-01-06 12:35   ` Jonathan Cameron
2018-01-06 12:50     ` Lars-Peter Clausen
2018-01-06 13:18       ` Julia Lawall
2018-01-06 14:17         ` Jonathan Cameron
2018-01-06 15:28     ` Joe Perches
2018-01-04 14:37 ` [PATCH 2/5] iio: core: " Aishwarya Pant
2018-01-04 14:38 ` [PATCH 3/5] iio: trigger: " Aishwarya Pant
2018-01-04 14:38 ` [PATCH 4/5] iio: hrtimer: " Aishwarya Pant
2018-01-04 14:38 ` [PATCH 5/5] iio: trigger: sysfs: use permisssion " Aishwarya Pant
2018-01-04 15:16 ` [PATCH 0/5] iio: use permission " Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox