From: Stuart Menefy Date: Mon, 24 Aug 2009 09:18:50 +0000 (+0900) Subject: sh: Fix underflow in SH udelay() code. X-Git-Tag: v2.6.32-rc1~640^2~35^2~14^2~5 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bd4fb4d4c1e4a5a2ffbf57a83817a749df1339dd;p=karo-tx-linux.git sh: Fix underflow in SH udelay() code. Signed-off-by: Stuart Menefy Signed-off-by: Paul Mundt --- diff --git a/arch/sh/lib/delay.c b/arch/sh/lib/delay.c index f3ddd2133e6f..faa8f86c0db4 100644 --- a/arch/sh/lib/delay.c +++ b/arch/sh/lib/delay.c @@ -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)