[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a3eN-m2DBg5OPters2f0J1onc_zGXGnMTDvr4uZD0UTNQ@mail.gmail.com>
Date: Fri, 28 Jul 2017 16:26:42 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Marcus Wolf <marcus.wolf@...f-entwicklungen.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devel@...verdev.osuosl.org
Subject: Re: [PATCH] staging: pi433: use div_u64 for 64-bit division
On Fri, Jul 28, 2017 at 4:21 PM, Marcus Wolf
<marcus.wolf@...f-entwicklungen.de> wrote:
> Hi Arnd,
>
> we already have a patch for this:
> [PATCH 1/1] staging: pi433: fix problem with division in rf69_set_deviation
> from 20.07.2017
>
> Maybe I did something wrong, but my first solution was exactly like your
> proposal. As far as I remeber, I wasn't able to compile it that way. Therefore I
> made a little bit more complicated fix. If I did something wrong and yours is
> fine, we should go for yours, because it is a shorter solution.
I think the problem with your original patch is that it doesn't work
for 'u64 factor':
do_div() is a bit tricky to work with, and it does not always accept a 64-bit
divisor, while div_u64 will simply convert the divisor to a u32.
You can also make 'factor' a 'u32' and keep using do_div.
Arnd
Powered by blists - more mailing lists