]> git.baikalelectronics.ru Git - kernel.git/commit
clk: sunxi-ng: fix recalc_rate formula of NKMP clocks
authorIcenowy Zheng <icenowy@aosc.xyz>
Fri, 17 Mar 2017 20:19:43 +0000 (04:19 +0800)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Mon, 20 Mar 2017 09:34:05 +0000 (10:34 +0100)
commitfd0003e3c58ba7c7175646ff80cd7a60d781e23f
tree4e8e49c564442885d61aa02141932aa71a378eae
parent867debb4560cb083b63e673e97ad85f5740ff24d
clk: sunxi-ng: fix recalc_rate formula of NKMP clocks

In commit c84939941d38 ("clk: sunxi-ng: Implement factors offsets"), the
final formula of NKMP clocks' recalc_rate is refactored; however, the
refactored formula broke the calculation due to some C language operand
priority problem -- the priority of operand >> is lower than * and /,
makes the formula being parsed as "(parent_rate * n * k) >> (p / m)", but
it should be "(parent_rate * n * k >> p) / m".

Add the pair of parentheses to fix up this issue. This pair of
parentheses used to exist in the old formula.

Fixes: c84939941d38 ("clk: sunxi-ng: Implement factors offsets")
Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
drivers/clk/sunxi-ng/ccu_nkmp.c