bmp280: use correct routine for division
PATCH v2 1/1 bmp280: use correct routine for division
The proper way to divide two signed 64-bit values is to use div64_s64.
Signed-off-by Vlad Dogaru <[email protected]>
Reported-by kbuild test robot <[email protected]>
---
Since v1: fix typo in commit message.
drivers/iio/pressure/bmp280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/bmp280.c +1 -1
@@ -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 );
Signature · 1 line
1.9.1
Jonathan Cameron
maintainerQuoted 4 lines · Vlad Dogaru
The proper way to divide two signed 64-bit values is to use
div64_s64.Signed-off-by Vlad Dogaru <[email protected]>Reported-by kbuild test robot <[email protected]>
Applied to the togreg branch of iio.git - initially pushed out as testing. Thanks,.
Jonathan
Quoted 21 lines
---
Since v1: fix typo in commit message.
drivers/iio/pressure/bmp280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/pressure/bmp280.c +1
-1@@ -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 );