aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorArtur Rojek <contact@artur-rojek.eu>2019-03-23 18:28:06 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-04-14 11:11:00 +0100
commit9f421096a16e75d22e69f766206f1bb0dc8fcf90 (patch)
treeb9cd33e7f4491e2a5e661b1023dbeb0d180949af /drivers/iio
parent1c163f4c7b3f621efff9b28a47abb36f7378d783 (diff)
downloadlinux-9f421096a16e75d22e69f766206f1bb0dc8fcf90.tar.gz
iio: inkern: API for reading available iio channel attribute values
Extend the inkern API with a function for reading available attribute values of iio channels. Signed-off-by: Artur Rojek <contact@artur-rojek.eu> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/inkern.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 06ca3f7fcc44..f19dbde3c945 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -733,6 +733,26 @@ static int iio_channel_read_avail(struct iio_channel *chan,
vals, type, length, info);
}
+int iio_read_avail_channel_attribute(struct iio_channel *chan,
+ const int **vals, int *type, int *length,
+ enum iio_chan_info_enum attribute)
+{
+ int ret;
+
+ mutex_lock(&chan->indio_dev->info_exist_lock);
+ if (!chan->indio_dev->info) {
+ ret = -ENODEV;
+ goto err_unlock;
+ }
+
+ ret = iio_channel_read_avail(chan, vals, type, length, attribute);
+err_unlock:
+ mutex_unlock(&chan->indio_dev->info_exist_lock);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(iio_read_avail_channel_attribute);
+
int iio_read_avail_channel_raw(struct iio_channel *chan,
const int **vals, int *length)
{