Re: [PATCH] clk: imx: Use do_div in SCCG due to 64-bit divisor

From: Stephen Rothwell
Date: Thu Nov 29 2018 - 21:18:02 EST


Hi Abel,

On Thu, 29 Nov 2018 23:50:22 +0000 Abel Vesa <abel.vesa@xxxxxxx> wrote:
>
> --- a/drivers/clk/imx/clk-frac-pll.c
> +++ b/drivers/clk/imx/clk-frac-pll.c
> @@ -116,12 +116,13 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
> unsigned long *prate)
> {
> u64 parent_rate = *prate;
> - u32 divff, divfi;
> - u64 temp64;
> + u64 divff, divfi;
> + u64 temp64 = rate;
>
> parent_rate *= 8;
> rate *= 2;
> - divfi = rate / parent_rate;
> + do_div(temp64, parent_rate);
> + divfi = temp64;

Did you mean to lose the doubling of "rate" above?

--
Cheers,
Stephen Rothwell

Attachment: pgpeGWQcpCGod.pgp
Description: OpenPGP digital signature