]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
clocksource: sh_cmt: Rate calculation fix
authorMagnus Damm <damm@opensource.se>
Mon, 2 Aug 2010 09:24:05 +0000 (09:24 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 4 Aug 2010 07:01:29 +0000 (16:01 +0900)
Fix the rate calculation in the CMT driver.
Without this fix the clocksource runs way
too fast and we get a divide-by-zero error.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/clocksource/sh_cmt.c

index ed8e07b97e271e8fa14e14ace319c216bf908232..a44611652282c6c173e70b861910d4bee1610db4 100644 (file)
@@ -445,7 +445,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
 
        /* clk_get_rate() needs an enabled clock */
        clk_enable(p->clk);
-       p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
+       p->rate = clk_get_rate(p->clk) / ((p->width == 16) ? 512 : 8);
        clk_disable(p->clk);
 
        /* TODO: calculate good shift from rate and counter bit width */