From: Randy Dunlap <rdunlap@infradead.org>
To: Greg KH <gregkh@linuxfoundation.org>, coolrrsh@gmail.com
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH] dma: dmatest: Use div64_s64
Date: Wed, 16 Aug 2023 11:38:44 -0700 [thread overview]
Message-ID: <1595571f-e69a-319e-0f8e-708c222706cb@infradead.org> (raw)
In-Reply-To: <2023081654-dormitory-vocally-02f7@gregkh>
On 8/16/23 08:16, Greg KH wrote:
> On Wed, Aug 16, 2023 at 11:34:00AM +0530, coolrrsh@gmail.com wrote:
>> From: Rajeshwar R Shinde <coolrrsh@gmail.com>
>>
>> In the function do_div, the dividend is evaluated multiple times
>> so it can cause side effects. Therefore replace it with div64_s64.
>>
>> This fixes warning such as:
>> drivers/dma/dmatest.c:496:1-7:
>> WARNING: do_div() does a 64-by-32 division,
>> please consider using div64_s64 instead.
>>
>> Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
>> ---
>> drivers/dma/dmatest.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
>> index ffe621695e47..07042f239db8 100644
>> --- a/drivers/dma/dmatest.c
>> +++ b/drivers/dma/dmatest.c
>> @@ -9,6 +9,7 @@
>>
>> #include <linux/err.h>
>> #include <linux/delay.h>
>> +#include <linux/math64.h>
>> #include <linux/dma-mapping.h>
>> #include <linux/dmaengine.h>
>> #include <linux/freezer.h>
>> @@ -493,7 +494,7 @@ static unsigned long long dmatest_persec(s64 runtime, unsigned int val)
>>
>> per_sec *= val;
>> per_sec = INT_TO_FIXPT(per_sec);
>> - do_div(per_sec, runtime);
>> + per_sec=div64_s64(per_sec, runtime);
>
> Please always run checkpatch.pl on your changes before submitting them
> for others to review.
Also please tell us what tool produced that warning message.
Thanks.
--
~Randy
next prev parent reply other threads:[~2023-08-16 18:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 6:04 [PATCH] dma: dmatest: Use div64_s64 coolrrsh
2023-08-16 15:16 ` Greg KH
2023-08-16 18:38 ` Randy Dunlap [this message]
2023-08-17 11:25 ` David Laight
-- strict thread matches above, loose matches on Subject: below --
2023-08-14 6:22 coolrrsh
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=1595571f-e69a-319e-0f8e-708c222706cb@infradead.org \
--to=rdunlap@infradead.org \
--cc=coolrrsh@gmail.com \
--cc=dmaengine@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@kernel.org \
/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