ftrace: use dynamic patching for updating mcount calls
[deliverable/linux.git] / arch / x86 / lib / delay_64.c
index 0ebbfb9e7c7f8d2b86abeb23f07b0cfbf0ebe56f..bbc610518516b11c4bdbe1d10dacd29ce41130c6 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/timex.h>
+#include <linux/preempt.h>
 #include <linux/delay.h>
+#include <linux/init.h>
+
 #include <asm/delay.h>
 #include <asm/msr.h>
 
@@ -18,7 +22,7 @@
 #include <asm/smp.h>
 #endif
 
-int read_current_timer(unsigned long *timer_value)
+int __devinit read_current_timer(unsigned long *timer_value)
 {
        rdtscll(*timer_value);
        return 0;
@@ -27,14 +31,15 @@ int read_current_timer(unsigned long *timer_value)
 void __delay(unsigned long loops)
 {
        unsigned bclock, now;
-       
+
+       preempt_disable();              /* TSC's are pre-cpu */
        rdtscl(bclock);
-       do
-       {
+       do {
                rep_nop(); 
                rdtscl(now);
        }
-       while((now-bclock) < loops);
+       while ((now-bclock) < loops);
+       preempt_enable();
 }
 EXPORT_SYMBOL(__delay);
 
This page took 0.024854 seconds and 5 git commands to generate.