sh: Fix underflow in SH udelay() code.
authorStuart Menefy <stuart.menefy@st.com>
Mon, 24 Aug 2009 09:18:50 +0000 (18:18 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 24 Aug 2009 09:18:50 +0000 (18:18 +0900)
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/lib/delay.c

index f3ddd21..faa8f86 100644 (file)
@@ -21,13 +21,14 @@ void __delay(unsigned long loops)
 
 inline void __const_udelay(unsigned long xloops)
 {
+       xloops *= 4;
        __asm__("dmulu.l        %0, %2\n\t"
                "sts    mach, %0"
                : "=r" (xloops)
                : "0" (xloops),
-                 "r" (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy)
+                 "r" (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4))
                : "macl", "mach");
-       __delay(xloops);
+       __delay(++xloops);
 }
 
 void __udelay(unsigned long usecs)