From: Uwe Kleine-König Date: Sat, 21 Feb 2015 10:40:24 +0000 (+0100) Subject: clk: divider: fix selection of divider when rounding to closest X-Git-Tag: omap-for-v4.1/wl12xx-dt~8^2~6 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26bac95aa88c2b1747808c0b885abe7814c0165d;p=pandora-kernel.git clk: divider: fix selection of divider when rounding to closest It's an invalid approach to assume that among two divider values the one nearer the exact divider is the better one. Assume a parent rate of 1000 Hz, a divider with CLK_DIVIDER_POWER_OF_TWO and a target rate of 89 Hz. The exact divider is ~ 11.236 so 8 and 16 are the candidates to choose from yielding rates 125 Hz and 62.5 Hz respectivly. While 8 is nearer to 11.236 than 16 is, the latter is still the better divider as 62.5 is nearer to 89 than 125 is. Fixes: 774b514390b1 (clk: divider: Add round to closest divider) Signed-off-by: Uwe Kleine-König Acked-by: Sascha Hauer Acked-by: Maxime Coquelin Signed-off-by: Michael Turquette --- Reading git-diff-tree failed