Commit 46ee98a2 authored by Vlad Dogaru's avatar Vlad Dogaru Committed by Jonathan Cameron

bmp280: use correct routine for division

The proper way to divide two signed 64-bit values is to use div64_s64.
Signed-off-by: default avatarVlad Dogaru <vlad.dogaru@intel.com>
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent d5c94568
...@@ -239,7 +239,7 @@ static u32 bmp280_compensate_press(struct bmp280_data *data, ...@@ -239,7 +239,7 @@ static u32 bmp280_compensate_press(struct bmp280_data *data,
return 0; return 0;
p = ((((s64) 1048576 - adc_press) << 31) - var2) * 3125; p = ((((s64) 1048576 - adc_press) << 31) - var2) * 3125;
do_div(p, var1); p = div64_s64(p, var1);
var1 = (((s64) comp->dig_p9) * (p >> 13) * (p >> 13)) >> 25; var1 = (((s64) comp->dig_p9) * (p >> 13) * (p >> 13)) >> 25;
var2 = (((s64) comp->dig_p8) * p) >> 19; var2 = (((s64) comp->dig_p8) * p) >> 19;
p = ((p + var1 + var2) >> 8) + (((s64) comp->dig_p7) << 4); p = ((p + var1 + var2) >> 8) + (((s64) comp->dig_p7) << 4);
......
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