All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] include: linux: iio: add IIO_DEVICE_ATTR_{RO,WO,RW} macros
@ 2016-09-25 17:29 Brian Masney
  2016-09-25 17:29 ` [PATCH 2/2] staging: iio: isl29018: use IIO_DEVICE_ATTR_{RO,RW} macros Brian Masney
  2016-09-25 17:58 ` [PATCH 1/2] include: linux: iio: add IIO_DEVICE_ATTR_{RO, WO, RW} macros Greg KH
  0 siblings, 2 replies; 17+ messages in thread
From: Brian Masney @ 2016-09-25 17:29 UTC (permalink / raw)
  To: jic23; +Cc: gregkh, linux-iio, devel

Add three new macros: IIO_DEVICE_ATTR_RO, IIO_DEVICE_ATTR_WO and
IIO_DEVICE_ATTR_RW to reduce the amount of boiler plate code that
is needed for creating new attributes. This mimics the *_RO, *_WO,
and *_RW macros that are found in include/linux/device.h and
include/linux/sysfs.h.

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 include/linux/iio/sysfs.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index 9cd8f74..f7c6431 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -59,6 +59,19 @@ struct iio_const_attr {
 	struct iio_dev_attr iio_dev_attr_##_name		\
 	= IIO_ATTR(_name, _mode, _show, _store, _addr)
 
+#define IIO_DEVICE_ATTR_RO(_name, _addr)			\
+	struct iio_dev_attr iio_dev_attr_##_name		\
+	= IIO_ATTR(_name, S_IRUGO, _name##_show, NULL, _addr)
+
+#define IIO_DEVICE_ATTR_WO(_name, _addr)			\
+	struct iio_dev_attr iio_dev_attr_##_name		\
+	= IIO_ATTR(_name, S_IWUSR, NULL, _name##_store, _addr)
+
+#define IIO_DEVICE_ATTR_RW(_name, _addr)			            \
+	struct iio_dev_attr iio_dev_attr_##_name		            \
+	= IIO_ATTR(_name, (S_IWUSR | S_IRUGO), _name##_show, _name##_store, \
+		   _addr)
+
 #define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \
 	struct iio_dev_attr iio_dev_attr_##_vname			\
 	= IIO_ATTR(_name, _mode, _show, _store, _addr)
-- 
2.7.4

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

end of thread, other threads:[~2016-10-01 15:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-25 17:29 [PATCH 1/2] include: linux: iio: add IIO_DEVICE_ATTR_{RO,WO,RW} macros Brian Masney
2016-09-25 17:29 ` [PATCH 2/2] staging: iio: isl29018: use IIO_DEVICE_ATTR_{RO,RW} macros Brian Masney
2016-09-25 17:58 ` [PATCH 1/2] include: linux: iio: add IIO_DEVICE_ATTR_{RO, WO, RW} macros Greg KH
2016-09-25 19:27   ` [PATCH v2 1/2] include: linux: iio: add IIO_ATTR_{RO,WO,RW} and IIO_DEVICE_ATTR_{RO,WO,RW} macros Brian Masney
2016-09-26  7:59     ` [PATCH v2 1/2] include: linux: iio: add IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros Greg KH
2016-09-27  0:20       ` [PATCH v3 1/5] " Brian Masney
2016-09-27  0:20         ` [PATCH v3 2/5] staging: iio: isl29018: use IIO_DEVICE_ATTR_{RO, " Brian Masney
2016-10-01 13:48           ` Jonathan Cameron
2016-09-27  0:20         ` [PATCH v3 3/5] staging: iio: isl29018: fixed race condition in in_illuminance_scale_available_show() Brian Masney
2016-10-01 13:53           ` Jonathan Cameron
2016-09-27  0:20         ` [PATCH v3 5/5] staging: iio: isl29018: check if the chip is in a suspended state Brian Masney
2016-10-01 13:59           ` Jonathan Cameron
2016-10-01 15:30             ` Brian Masney
2016-10-01 15:56               ` Jonathan Cameron
2016-10-01 13:47         ` [PATCH v3 1/5] include: linux: iio: add IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros Jonathan Cameron
     [not found]         ` <1474935620-13151-4-git-send-email-masneyb@onstation.org>
2016-10-01 13:55           ` [PATCH v3 4/5] staging: iio: isl29018: change isl29018_read_raw() to only have one exit point Jonathan Cameron
2016-09-25 19:27   ` [PATCH v2 2/2] staging: iio: isl29018: use IIO_DEVICE_ATTR_{RO,RW} macros Brian Masney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.