From 9fbfb4b37ed23f71aa9484484266381c6c6964cb Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada Date: Tue, 29 Apr 2014 00:51:00 +0100 Subject: IIO: core: Introduce read_raw_multi This callback is introduced to overcome some limitations of existing read_raw callback. The functionality of both existing read_raw and read_raw_multi is similar, both are used to request values from the device. The current read_raw callback allows only two return values. The new read_raw_multi allows returning multiple values. Instead of passing just address of val and val2, it passes length and pointer to values. Depending on the type and length of passed buffer, iio client drivers can return multiple values. Signed-off-by: Srinivas Pandruvada Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/iio/industrialio-event.c') diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index dddfb0f90d34..258a973a1fb8 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -270,7 +270,7 @@ static ssize_t iio_ev_value_show(struct device *dev, { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - int val, val2; + int val, val2, val_arr[2]; int ret; ret = indio_dev->info->read_event_value(indio_dev, @@ -279,7 +279,9 @@ static ssize_t iio_ev_value_show(struct device *dev, &val, &val2); if (ret < 0) return ret; - return iio_format_value(buf, ret, val, val2); + val_arr[0] = val; + val_arr[1] = val2; + return iio_format_value(buf, ret, 2, val_arr); } static ssize_t iio_ev_value_store(struct device *dev, -- cgit v1.2.3