summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/qcom-spmi-vadc.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-19 00:08:58 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-19 00:08:58 +0300
commit02730d3c053a9af1d402e1c8dc8bbbc5a1340406 (patch)
treedb289a08de50eb4b5caf7840d5b7356ddfa1c51f /drivers/iio/adc/qcom-spmi-vadc.c
parent77232f791e0605521a978cbe7f79a93df24df374 (diff)
parente26081808edadfd257c6c9d81014e3b25e9a6118 (diff)
downloadlinux-02730d3c053a9af1d402e1c8dc8bbbc5a1340406.tar.xz
Merge 4.1-rc4 into tty-next
This resolves some tty driver merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/adc/qcom-spmi-vadc.c')
-rw-r--r--drivers/iio/adc/qcom-spmi-vadc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index 3211729bcb0b..0c4618b4d515 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -18,6 +18,7 @@
#include <linux/iio/iio.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
@@ -471,11 +472,11 @@ static s32 vadc_calibrate(struct vadc_priv *vadc,
const struct vadc_channel_prop *prop, u16 adc_code)
{
const struct vadc_prescale_ratio *prescale;
- s32 voltage;
+ s64 voltage;
voltage = adc_code - vadc->graph[prop->calibration].gnd;
voltage *= vadc->graph[prop->calibration].dx;
- voltage = voltage / vadc->graph[prop->calibration].dy;
+ voltage = div64_s64(voltage, vadc->graph[prop->calibration].dy);
if (prop->calibration == VADC_CALIB_ABSOLUTE)
voltage += vadc->graph[prop->calibration].dx;
@@ -487,7 +488,7 @@ static s32 vadc_calibrate(struct vadc_priv *vadc,
voltage = voltage * prescale->den;
- return voltage / prescale->num;
+ return div64_s64(voltage, prescale->num);
}
static int vadc_decimation_from_dt(u32 value)