staging: iio: Support second value read back on iio_st_read_channel_raw
Jinyoung Park [Thu, 20 Jun 2013 08:55:41 +0000 (17:55 +0900)]
Support second value read back on iio_st_read_channel_raw.

Bug 1287901

Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/241373
(cherry picked from commit f8664172759b7846bd046779c1ca4be672a6fee8)

Change-Id: I2d5eb06ae3434fbca8a92591e8b498340371c771
Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/252879
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/staging/iio/iio_hwmon.c
drivers/staging/iio/inkern.c
include/linux/iio/consumer.h

index b03554f..acdfccf 100644 (file)
@@ -52,7 +52,7 @@ static ssize_t iio_hwmon_read_val(struct device *dev,
         * the scale has changed.
         */
        ret = iio_st_read_channel_raw(&state->channels[sattr->index],
-                                     &val);
+                                     &val, 0);
        if (ret < 0)
                return ret;
 
index 49346b5..2802a91 100644 (file)
@@ -232,9 +232,9 @@ void iio_st_channel_release_all(struct iio_channel *channels)
 }
 EXPORT_SYMBOL_GPL(iio_st_channel_release_all);
 
-int iio_st_read_channel_raw(struct iio_channel *chan, int *val)
+int iio_st_read_channel_raw(struct iio_channel *chan, int *val, int *val2)
 {
-       int val2, ret;
+       int ret;
 
        mutex_lock(&chan->indio_dev->info_exist_lock);
        if (chan->indio_dev->info == NULL) {
@@ -243,7 +243,7 @@ int iio_st_read_channel_raw(struct iio_channel *chan, int *val)
        }
 
        ret = chan->indio_dev->info->read_raw(chan->indio_dev, chan->channel,
-                                             val, &val2, 0);
+                                             val, val2, 0);
 err_unlock:
        mutex_unlock(&chan->indio_dev->info_exist_lock);
 
index 1a15e56..8d3f45b 100644 (file)
@@ -62,13 +62,14 @@ void iio_st_channel_release_all(struct iio_channel *chan);
 /**
  * iio_st_read_channel_raw() - read from a given channel
  * @channel:           The channel being queried.
- * @val:               Value read back.
+ * @val:               First part of value read back.
+ * @val2:              Second part of value read back.
  *
  * Note raw reads from iio channels are in adc counts and hence
  * scale will need to be applied if standard units required.
  */
 int iio_st_read_channel_raw(struct iio_channel *chan,
-                           int *val);
+                           int *val, int *val2);
 
 /**
  * iio_st_get_channel_type() - get the type of a channel