aboutsummaryrefslogtreecommitdiffstats
path: root/arch/openrisc/lib/delay.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/openrisc/lib/delay.c')
-rw-r--r--arch/openrisc/lib/delay.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/openrisc/lib/delay.c b/arch/openrisc/lib/delay.c
index 01d9740ae6f..c330767c921 100644
--- a/arch/openrisc/lib/delay.c
+++ b/arch/openrisc/lib/delay.c
@@ -30,9 +30,9 @@ int __devinit read_current_timer(unsigned long *timer_value)
30 30
31void __delay(unsigned long cycles) 31void __delay(unsigned long cycles)
32{ 32{
33 cycles_t target = get_cycles() + cycles; 33 cycles_t start = get_cycles();
34 34
35 while (get_cycles() < target) 35 while ((get_cycles() - start) < cycles)
36 cpu_relax(); 36 cpu_relax();
37} 37}
38EXPORT_SYMBOL(__delay); 38EXPORT_SYMBOL(__delay);
@@ -41,7 +41,7 @@ inline void __const_udelay(unsigned long xloops)
41{ 41{
42 unsigned long long loops; 42 unsigned long long loops;
43 43
44 loops = xloops * loops_per_jiffy * HZ; 44 loops = (unsigned long long)xloops * loops_per_jiffy * HZ;
45 45
46 __delay(loops >> 32); 46 __delay(loops >> 32);
47} 47}