clk: at91: usb: fix at91sam9x5 recalc, round and set rate
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 17 Nov 2014 13:16:56 +0000 (14:16 +0100)
committerMichael Turquette <mturquette@linaro.org>
Mon, 17 Nov 2014 18:38:40 +0000 (10:38 -0800)
commit69daf75aafc8410ef046c70be65c71f2dd4e08f9
treebe9397ee4a44717bcd8648816ddeff31284ef83c
parentff553ea1a3d5b903becda790eeb6bd3debf239f9
clk: at91: usb: fix at91sam9x5 recalc, round and set rate

First check for rate == 0 in set_rate and round_rate to avoid div by zero.
Then, in order to get the closest rate, round all divisions to the closest
result instead of rounding them down.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
drivers/clk/at91/clk-usb.c