From 998f129c76e2030ad2e68cf59d75eef0e5a58fd3 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 28 Sep 2013 10:31:00 +0100 Subject: [PATCH] iio:max517: Report scale as fractional value Move the complexity of calculating the fixed point scale to the core. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/dac/max517.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c index 83adcbf1a205..d26be14fff64 100644 --- a/drivers/iio/dac/max517.c +++ b/drivers/iio/dac/max517.c @@ -82,15 +82,13 @@ static int max517_read_raw(struct iio_dev *indio_dev, long m) { struct max517_data *data = iio_priv(indio_dev); - unsigned int scale_uv; switch (m) { case IIO_CHAN_INFO_SCALE: /* Corresponds to Vref / 2^(bits) */ - scale_uv = (data->vref_mv[chan->channel] * 1000) >> 8; - *val = scale_uv / 1000000; - *val2 = scale_uv % 1000000; - return IIO_VAL_INT_PLUS_MICRO; + *val = data->vref_mv[chan->channel]; + *val2 = 8; + return IIO_VAL_FRACTIONAL_LOG2; default: break; } -- 2.30.2