Commit 2bd72d84 authored by Jonathan Cameron's avatar Jonathan Cameron

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: default avatarJonathan Cameron <jic23@kernel.org>
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Cc: Rama Krishna Phani A <rphani@codeaurora.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent c3b2fdd0
...@@ -658,13 +658,15 @@ static int vadc_scale_die_temp(struct vadc_priv *vadc, ...@@ -658,13 +658,15 @@ static int vadc_scale_die_temp(struct vadc_priv *vadc,
{ {
const struct vadc_prescale_ratio *prescale; const struct vadc_prescale_ratio *prescale;
s64 voltage = 0; s64 voltage = 0;
u64 temp; /* Temporary variable for do_div */
vadc_scale_calib(vadc, adc_code, prop, &voltage); vadc_scale_calib(vadc, adc_code, prop, &voltage);
if (voltage > 0) { if (voltage > 0) {
prescale = &vadc_prescale_ratios[prop->prescale]; prescale = &vadc_prescale_ratios[prop->prescale];
voltage = voltage * prescale->den; temp = voltage * prescale->den;
voltage /= (prescale->num * 2); do_div(temp, prescale->num * 2);
voltage = temp;
} else { } else {
voltage = 0; voltage = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment