From 73a4445f302f6bf54940d36659bb008d018cef98 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 14 Jun 2013 16:58:00 +0100 Subject: [PATCH] staging:iio:ad7291: Use IIO_VAL_FRACTIONAL_LOG2 This is a bit more straight forward and also allows better precession when using the an in-kernel consumer. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/ad7291.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index d088c662d5cd..a3a3a2f27584 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c @@ -456,7 +456,6 @@ static int ad7291_read_raw(struct iio_dev *indio_dev, { int ret; struct ad7291_chip_info *chip = iio_priv(indio_dev); - unsigned int scale_uv; u16 regval; s16 signval; @@ -513,10 +512,9 @@ static int ad7291_read_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_SCALE: switch (chan->type) { case IIO_VOLTAGE: - scale_uv = (chip->int_vref_mv * 1000) >> AD7291_BITS; - *val = scale_uv / 1000; - *val2 = (scale_uv % 1000) * 1000; - return IIO_VAL_INT_PLUS_MICRO; + *val = chip->int_vref_mv; + *val2 = AD7291_BITS; + return IIO_VAL_FRACTIONAL_LOG2; case IIO_TEMP: /* * One LSB of the ADC corresponds to 0.25 deg C. -- 2.39.5