linux-mips
[Top] [All Lists]

[PATCH] Fix calculation in clockevent_set_clock()

To: linux-mips@linux-mips.org
Subject: [PATCH] Fix calculation in clockevent_set_clock()
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Sat, 20 Oct 2007 00:28:33 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index c4e6866..6c6849a 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -195,8 +195,8 @@ void __cpuinit clockevent_set_clock(struct 
clock_event_device *cd,
 
        /* Find a shift value */
        for (shift = 32; shift > 0; shift--) {
-               temp = (u64) NSEC_PER_SEC << shift;
-               do_div(temp, clock);
+               temp = (u64) clock << shift;
+               do_div(temp, NSEC_PER_SEC);
                if ((temp >> 32) == 0)
                        break;
        }

<Prev in Thread] Current Thread [Next in Thread>