Skip to content

Commit

Permalink
staging:iio:ad7887: Use passed in chan spec in ad7887_read_raw
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Nov 5, 2012
1 parent fce7c3e commit 98efb70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/iio/adc/ad7887.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,

if (ret < 0)
return ret;
*val = (ret >> st->chip_info->channel[0].scan_type.shift) &
RES_MASK(st->chip_info->channel[0].scan_type.realbits);
*val = ret >> chan->scan_type.shift;
*val &= RES_MASK(chan->scan_type.realbits);
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
if (st->reg) {
Expand All @@ -190,7 +190,7 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
*val = st->chip_info->int_vref_mv;
}

*val2 = st->chip_info->channel[0].scan_type.realbits;
*val2 = chan->scan_type.realbits;

return IIO_VAL_FRACTIONAL_LOG2;
}
Expand Down

0 comments on commit 98efb70

Please sign in to comment.