diff options
author | Jonathan Cameron <jic23@kernel.org> | 2013-02-19 21:10:30 (GMT) |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-03-17 19:49:09 (GMT) |
commit | 8655cc490e83f66476de8c1294411860325c3531 (patch) | |
tree | 2bb6ceece8cf1694264fb00a27e560b2c3fc6547 /drivers/iio/industrialio-core.c | |
parent | 10f5b14811023df0ba1a936b14880eabb6d9c199 (diff) | |
download | linux-fsl-qoriq-8655cc490e83f66476de8c1294411860325c3531.tar.xz |
iio: Add broken out info_mask fields for shared_by_type and separate
This simplifies the code, removes an extensive layer of 'helper' macros
and gives us twice as much room to play with in these masks before we
have any need to be clever.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r-- | drivers/iio/industrialio-core.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 6d8b027..f05289f 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -708,6 +708,36 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev, goto error_ret; attrcount++; } + for_each_set_bit(i, &chan->info_mask_separate, sizeof(long)*8) { + ret = __iio_add_chan_devattr(iio_chan_info_postfix[i], + chan, + &iio_read_channel_info, + &iio_write_channel_info, + i, + 0, + &indio_dev->dev, + &indio_dev->channel_attr_list); + if (ret < 0) + goto error_ret; + attrcount++; + } + for_each_set_bit(i, &chan->info_mask_shared_by_type, sizeof(long)*8) { + ret = __iio_add_chan_devattr(iio_chan_info_postfix[i], + chan, + &iio_read_channel_info, + &iio_write_channel_info, + i, + 1, + &indio_dev->dev, + &indio_dev->channel_attr_list); + if (ret == -EBUSY) { + ret = 0; + continue; + } else if (ret < 0) { + goto error_ret; + } + attrcount++; + } if (chan->ext_info) { unsigned int i = 0; |