From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Kang Minchul <tegongkang@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: iio: Use div64_ul instead of do_div
Date: Thu, 20 Oct 2022 17:27:12 +0200 [thread overview]
Message-ID: <Y1Fo0NmzspXRS92n@kroah.com> (raw)
In-Reply-To: <20221019053829.821918-1-tegongkang@gmail.com>
On Wed, Oct 19, 2022 at 02:38:29PM +0900, Kang Minchul wrote:
> Using div64_ul instead of do_div (64-by-32 division) is more
> recommended by coccicheck because this can avoid potential truncation.
>
> So this commit changes do_div to div64_ul and
> remove coccicheck warnings.
>
> Signed-off-by: Kang Minchul <tegongkang@gmail.com>
> ---
> drivers/staging/iio/frequency/ad9832.c | 2 +-
> drivers/staging/iio/frequency/ad9834.c | 2 +-
> drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> index 6f9eebd6c7ee..cd038480f63c 100644
> --- a/drivers/staging/iio/frequency/ad9832.c
> +++ b/drivers/staging/iio/frequency/ad9832.c
> @@ -122,7 +122,7 @@ static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout)
> {
> unsigned long long freqreg = (u64)fout *
> (u64)((u64)1L << AD9832_FREQ_BITS);
> - do_div(freqreg, mclk);
> + freqreg = div64_ul(freqreg, mclk);
I think the original code here is correct, no need for a change, unless
you have the hardware to test this out and can verify it all still works
identically.
thanks,
greg k-h
prev parent reply other threads:[~2022-10-20 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 5:38 [PATCH] staging: iio: Use div64_ul instead of do_div Kang Minchul
2022-10-20 15:27 ` Greg Kroah-Hartman [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=Y1Fo0NmzspXRS92n@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Michael.Hennerich@analog.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=tegongkang@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox