patch-2.2.18 linux/arch/i386/lib/delay.c

Next file: linux/arch/i386/math-emu/get_address.c
Previous file: linux/arch/i386/lib/Makefile
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/arch/i386/lib/delay.c linux/arch/i386/lib/delay.c
@@ -22,8 +22,7 @@
 	
 /*
  *	Do a udelay using the TSC for any CPU that happens
- *	to have one that we trust. This could be optimised to avoid
- *	the multiply per loop but its a delay loop so who are we kidding...
+ *	to have one that we trust.
  */
 
 static void __rdtsc_delay(unsigned long loops)
@@ -63,13 +62,19 @@
 		__loop_delay(loops);
 }
 
+/*
+ *	This could be optimised to avoid the multiply per loop but its a
+ *	delay loop so who are we kidding...  (we'd run into nasty 32-bit
+ *	issues with delays > 10 ms or HZ > 100 that way)
+ */
+
 void __const_udelay(unsigned long xloops)
 {
 	int d0;
 	__asm__("mull %0"
 		:"=d" (xloops), "=&a" (d0)
-		:"1" (xloops),"0" (current_cpu_data.loops_per_sec));
-        __delay(xloops);
+		:"1" (xloops),"0" (current_cpu_data.loops_per_jiffy));
+        __delay(xloops * HZ);
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)