Skip to content

iio: use permission specific variants of DEVICE_ATTR

Aishwarya Pant linux-iio lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5iio: buffer: use permission specific variants of DEVICE_ATTRdrivers/iio/industrialio-buffer.c+11 -145 replies
2/5iio: core: use permission specific variants of DEVICE_ATTRdrivers/iio/industrialio-core.c+5 -60 replies
3/5iio: trigger: use permission specific variants of DEVICE_ATTRdrivers/iio/industrialio-trigger.c+8 -100 replies
4/5iio: hrtimer: use permission specific variants of DEVICE_ATTRdrivers/iio/trigger/iio-trig-hrtimer.c+3 -50 replies
5/5iio: trigger: sysfs: use permisssion specific variants of DEVICE_ATTRdrivers/iio/trigger/iio-trig-sysfs.c+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] iio: use permission specific variants of DEVICE_ATTR

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(-)
Signature · 1 line
2.15.1