From 3704432fb1fd8ab2df114bad6df752381246b609 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sun, 8 Sep 2013 14:57:00 +0100 Subject: iio: refactor info mask and ext_info attribute creation. Introduce an enum to specify whether the attribute is separate or shared. Factor out the bitmap handling for loop into a separate function. Tidy up error handling and add a NULL assignment to squish a false positive warning from GCC. Change ext_info shared type from boolean to enum and update in all drivers. Signed-off-by: Jonathan Cameron Reviewed-by: Lars-Peter Clausen --- include/linux/iio/iio.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index bc408e2def40..21de272f1eb6 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -39,6 +39,11 @@ enum iio_chan_info_enum { IIO_CHAN_INFO_INT_TIME, }; +enum iio_shared_by { + IIO_SEPARATE, + IIO_SHARED_BY_TYPE +}; + enum iio_endian { IIO_CPU, IIO_BE, @@ -58,7 +63,7 @@ struct iio_dev; */ struct iio_chan_spec_ext_info { const char *name; - bool shared; + enum iio_shared_by shared; ssize_t (*read)(struct iio_dev *, uintptr_t private, struct iio_chan_spec const *, char *buf); ssize_t (*write)(struct iio_dev *, uintptr_t private, @@ -126,7 +131,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, #define IIO_ENUM_AVAILABLE(_name, _e) \ { \ .name = (_name "_available"), \ - .shared = true, \ + .shared = IIO_SHARED_BY_TYPE, \ .read = iio_enum_available_read, \ .private = (uintptr_t)(_e), \ } -- cgit v1.2.3