summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/qcom-spmi-vadc.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2016-12-30 19:25:49 +0100
committerJonathan Cameron <jic23@kernel.org>2017-01-10 20:54:59 +0100
commit2bd72d84f6bc4dcdcc2b5d98881a9da536925b48 (patch)
tree483356a8e2420fd83cca7f2d51dd9dce2bebcd50 /drivers/iio/adc/qcom-spmi-vadc.c
parentiio: adc: hx711: Add IIO driver for AVIA HX711 (diff)
downloadlinux-2bd72d84f6bc4dcdcc2b5d98881a9da536925b48.tar.xz
linux-2bd72d84f6bc4dcdcc2b5d98881a9da536925b48.zip
iio:adc:qcom-spmi-vadc : fix undefined __divdi3
A simple do_div call works here as all the signed 64 bit is actually small and unsigned at this point, and the numerator is u32. Introduce a temporary u64 variable to avoid type comparison warnings on some architectures. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc/qcom-spmi-vadc.c')
-rw-r--r--drivers/iio/adc/qcom-spmi-vadc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index aaf4caf06505..18eb2955cc21 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -658,13 +658,15 @@ static int vadc_scale_die_temp(struct vadc_priv *vadc,
{
const struct vadc_prescale_ratio *prescale;
s64 voltage = 0;
+ u64 temp; /* Temporary variable for do_div */
vadc_scale_calib(vadc, adc_code, prop, &voltage);
if (voltage > 0) {
prescale = &vadc_prescale_ratios[prop->prescale];
- voltage = voltage * prescale->den;
- voltage /= (prescale->num * 2);
+ temp = voltage * prescale->den;
+ do_div(temp, prescale->num * 2);
+ voltage = temp;
} else {
voltage = 0;
}