OSDN Git Service

iio: adc: spmi-vadc: Fix overflow in output value normalization
authorIvan T. Ivanov <ivan.ivanov@linaro.org>
Fri, 17 Apr 2015 14:51:08 +0000 (17:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Jun 2015 15:20:54 +0000 (08:20 -0700)
commite2e88802cbfddfd4bbca095782fba56d07b437d0
tree85baf7467b1d04b2f492a6a971225ad313d31320
parente8dcff4f3a730f497b6c62dc98f752966fd5523f
iio: adc: spmi-vadc: Fix overflow in output value normalization

commit 937125aca00e0478c4024afe58bc620a7bbe2a93 upstream.

With 'dx' equal to 0.625V and 15 bit ADC, calculations overflow
when difference against GND is ~20% of the ADC range. Fix this.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/qcom-spmi-vadc.c