]> err.no Git - linux-2.6/blobdiff - arch/x86/lib/delay_32.c
Merge branch 'smsc47b397-new-id' into release
[linux-2.6] / arch / x86 / lib / delay_32.c
index f6edb11364dfe5edef9ffac33341b24307a85434..4535e6d147adb11ffb570a9adcb4e08c6d638130 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/processor.h>
 #include <asm/delay.h>
@@ -42,11 +45,13 @@ static void delay_tsc(unsigned long loops)
 {
        unsigned long bclock, now;
 
+       preempt_disable();              /* TSC's are per-cpu */
        rdtscl(bclock);
        do {
                rep_nop();
                rdtscl(now);
        } while ((now-bclock) < loops);
+       preempt_enable();
 }
 
 /*
@@ -60,7 +65,7 @@ void use_tsc_delay(void)
        delay_fn = delay_tsc;
 }
 
-int read_current_timer(unsigned long *timer_val)
+int __devinit read_current_timer(unsigned long *timer_val)
 {
        if (delay_fn == delay_tsc) {
                rdtscl(*timer_val);
@@ -82,7 +87,7 @@ inline void __const_udelay(unsigned long xloops)
        __asm__("mull %0"
                :"=d" (xloops), "=&a" (d0)
                :"1" (xloops), "0"
-               (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4)));
+               (cpu_data(raw_smp_processor_id()).loops_per_jiffy * (HZ/4)));
 
        __delay(++xloops);
 }