aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/inkern.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/inkern.c')
-rw-r--r--drivers/iio/inkern.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index adeba5a0ecf7..d833d55052ea 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -417,12 +417,24 @@ static int iio_channel_read(struct iio_channel *chan, int *val, int *val2,
417 enum iio_chan_info_enum info) 417 enum iio_chan_info_enum info)
418{ 418{
419 int unused; 419 int unused;
420 int vals[INDIO_MAX_RAW_ELEMENTS];
421 int ret;
422 int val_len = 2;
420 423
421 if (val2 == NULL) 424 if (val2 == NULL)
422 val2 = &unused; 425 val2 = &unused;
423 426
424 return chan->indio_dev->info->read_raw(chan->indio_dev, chan->channel, 427 if (chan->indio_dev->info->read_raw_multi) {
425 val, val2, info); 428 ret = chan->indio_dev->info->read_raw_multi(chan->indio_dev,
429 chan->channel, INDIO_MAX_RAW_ELEMENTS,
430 vals, &val_len, info);
431 *val = vals[0];
432 *val2 = vals[1];
433 } else
434 ret = chan->indio_dev->info->read_raw(chan->indio_dev,
435 chan->channel, val, val2, info);
436
437 return ret;
426} 438}
427 439
428int iio_read_channel_raw(struct iio_channel *chan, int *val) 440int iio_read_channel_raw(struct iio_channel *chan, int *val)