All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Vlad Dogaru <vlad.dogaru@intel.com>, linux-iio@vger.kernel.org
Subject: Re: [PATCH v2] bmp280: use correct routine for division
Date: Sat, 25 Oct 2014 10:45:20 +0100	[thread overview]
Message-ID: <544B7130.4000506@kernel.org> (raw)
In-Reply-To: <1414075979-5831-1-git-send-email-vlad.dogaru@intel.com>

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

      reply	other threads:[~2014-10-25 19:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 14:52 [PATCH v2] bmp280: use correct routine for division Vlad Dogaru
2014-10-25  9:45 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=544B7130.4000506@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=vlad.dogaru@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.