mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 14:12:51 +00:00
staging:iio:adc:ad799x trivial: use the convenient chan struct.
This is much cleaner than bouncing through the various structures to get to the same thing. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
7c626f58ab
commit
5357ba3df4
@ -158,12 +158,11 @@ static int ad799x_read_raw(struct iio_dev *dev_info,
|
|||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
*val = (ret >> st->chip_info->channel[0].scan_type.shift) &
|
*val = (ret >> chan->scan_type.shift) &
|
||||||
RES_MASK(st->chip_info->channel[0].scan_type.realbits);
|
RES_MASK(chan->scan_type.realbits);
|
||||||
return IIO_VAL_INT;
|
return IIO_VAL_INT;
|
||||||
case (1 << IIO_CHAN_INFO_SCALE_SHARED):
|
case (1 << IIO_CHAN_INFO_SCALE_SHARED):
|
||||||
scale_uv = (st->int_vref_mv * 1000)
|
scale_uv = (st->int_vref_mv * 1000) >> chan->scan_type.realbits;
|
||||||
>> st->chip_info->channel[0].scan_type.realbits;
|
|
||||||
*val = scale_uv / 1000;
|
*val = scale_uv / 1000;
|
||||||
*val2 = (scale_uv % 1000) * 1000;
|
*val2 = (scale_uv % 1000) * 1000;
|
||||||
return IIO_VAL_INT_PLUS_MICRO;
|
return IIO_VAL_INT_PLUS_MICRO;
|
||||||
|
Loading…
Reference in New Issue
Block a user