Skip to content

Commit f12d028

Browse files
claudiubezneabebarino
authored andcommitted
clk: at91: sam9x60-pll: use DIV_ROUND_CLOSEST_ULL
Use DIV_ROUND_CLOSEST_ULL() to avoid any inconsistency b/w the rate computed in sam9x60_frac_pll_recalc_rate() and the one computed in sam9x60_frac_pll_compute_mul_frac(). Fixes: 43b1bb4 ("clk: at91: clk-sam9x60-pll: re-factor to support plls with multiple outputs") Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 5df4cd9 commit f12d028

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/clk/at91/clk-sam9x60-pll.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ static unsigned long sam9x60_frac_pll_recalc_rate(struct clk_hw *hw,
7373
struct sam9x60_pll_core *core = to_sam9x60_pll_core(hw);
7474
struct sam9x60_frac *frac = to_sam9x60_frac(core);
7575

76-
return (parent_rate * (frac->mul + 1) +
77-
((u64)parent_rate * frac->frac >> 22));
76+
return parent_rate * (frac->mul + 1) +
77+
DIV_ROUND_CLOSEST_ULL((u64)parent_rate * frac->frac, (1 << 22));
7878
}
7979

8080
static int sam9x60_frac_pll_set(struct sam9x60_pll_core *core)

0 commit comments

Comments
 (0)