All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] bmp280: use correct routine for division
@ 2014-10-23 14:52 Vlad Dogaru
  2014-10-25  9:45 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Vlad Dogaru @ 2014-10-23 14:52 UTC (permalink / raw)
  To: jic23, linux-iio; +Cc: Vlad Dogaru

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>
---

Since v1: fix typo in commit message.

 drivers/iio/pressure/bmp280.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c
index fb91cb3..ce29ff9 100644
--- a/drivers/iio/pressure/bmp280.c
+++ b/drivers/iio/pressure/bmp280.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] bmp280: use correct routine for division
  2014-10-23 14:52 [PATCH v2] bmp280: use correct routine for division Vlad Dogaru
@ 2014-10-25  9:45 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2014-10-25  9:45 UTC (permalink / raw)
  To: Vlad Dogaru, linux-iio

On 23/10/14 15:52, Vlad Dogaru wrote:
> 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>
Applied to the togreg branch of iio.git - initially pushed out as testing.
Thanks,.

Jonathan
> ---
> 
> Since v1: fix typo in commit message.
> 
>  drivers/iio/pressure/bmp280.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c
> index fb91cb3..ce29ff9 100644
> --- a/drivers/iio/pressure/bmp280.c
> +++ b/drivers/iio/pressure/bmp280.c
> @@ -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);
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-25 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 14:52 [PATCH v2] bmp280: use correct routine for division Vlad Dogaru
2014-10-25  9:45 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.