linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: sh_cmt: Rate calculation fix
@ 2010-08-02  9:24 Magnus Damm
  2010-08-04  7:45 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2010-08-02  9:24 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

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>
---

 drivers/clocksource/sh_cmt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 0001/drivers/clocksource/sh_cmt.c
+++ work/drivers/clocksource/sh_cmt.c	2010-08-02 16:52:29.000000000 +0900
@@ -445,7 +445,7 @@ static int sh_cmt_register_clocksource(s
 
 	/* 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 */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] clocksource: sh_cmt: Rate calculation fix
  2010-08-02  9:24 [PATCH] clocksource: sh_cmt: Rate calculation fix Magnus Damm
@ 2010-08-04  7:45 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2010-08-04  7:45 UTC (permalink / raw)
  To: linux-sh

On Mon, Aug 02, 2010 at 06:24:05PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> 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>

On Wed, Aug 04, 2010 at 01:31:38PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Fix a one-off error in the CMT driver V2. The match register
> should be programmed with the period minus one.
> 
> Many thanks to Eiraku-san for tracking down this issue.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-04  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-02  9:24 [PATCH] clocksource: sh_cmt: Rate calculation fix Magnus Damm
2010-08-04  7:45 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).