aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-11-05 04:56:00 -0500
committerJonathan Cameron <jic23@kernel.org>2012-11-05 15:39:53 -0500
commit98efb70adde96d86df29b4754f265b2c8bba01b2 (patch)
treebfe33509527d200779a0effedd6d36c3a43059e2 /drivers/staging/iio
parentfce7c3eac7d4ca77ada5bf8332f867219fbb5068 (diff)
staging:iio:ad7887: Use passed in chan spec in ad7887_read_raw
Use the passed in chan spec in ad7887_read_raw instead of alawys using the first chan spec entry from the chip info data. Since all channels have the same shift and realbits from a functional point of view it does not matter which chan spec is used, but the patch makes the a bit more clear. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/adc/ad7887.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/iio/adc/ad7887.c b/drivers/staging/iio/adc/ad7887.c
index 3ac0c305e12..72cfe191cd8 100644
--- a/drivers/staging/iio/adc/ad7887.c
+++ b/drivers/staging/iio/adc/ad7887.c
@@ -177,8 +177,8 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
177 177
178 if (ret < 0) 178 if (ret < 0)
179 return ret; 179 return ret;
180 *val = (ret >> st->chip_info->channel[0].scan_type.shift) & 180 *val = ret >> chan->scan_type.shift;
181 RES_MASK(st->chip_info->channel[0].scan_type.realbits); 181 *val &= RES_MASK(chan->scan_type.realbits);
182 return IIO_VAL_INT; 182 return IIO_VAL_INT;
183 case IIO_CHAN_INFO_SCALE: 183 case IIO_CHAN_INFO_SCALE:
184 if (st->reg) { 184 if (st->reg) {
@@ -190,7 +190,7 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
190 *val = st->chip_info->int_vref_mv; 190 *val = st->chip_info->int_vref_mv;
191 } 191 }
192 192
193 *val2 = st->chip_info->channel[0].scan_type.realbits; 193 *val2 = chan->scan_type.realbits;
194 194
195 return IIO_VAL_FRACTIONAL_LOG2; 195 return IIO_VAL_FRACTIONAL_LOG2;
196 } 196 }