Re: [PATCH] staging: pi433: use div_u64 for 64-bit division

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 28, 2017 at 4:21 PM, Marcus Wolf
<marcus.wolf@xxxxxxxxxxxxxxxxxxxxx> 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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux