Skip to content

Commit

Permalink
bmp280: use correct routine for division
Browse files Browse the repository at this point in the history
The proper way to divide two signed 64-bit values is to use div64_s64.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Vlad Dogaru authored and Jonathan Cameron committed Oct 25, 2014
1 parent d5c9456 commit 46ee98a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/pressure/bmp280.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static u32 bmp280_compensate_press(struct bmp280_data *data,
return 0;

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;
var2 = (((s64) comp->dig_p8) * p) >> 19;
p = ((p + var1 + var2) >> 8) + (((s64) comp->dig_p7) << 4);
Expand Down

0 comments on commit 46ee98a

Please sign in to comment.