]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sh/kernel/time_64.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / arch / sh / kernel / time_64.c
index 81003af8115a6f5c6f9b5ba7f1a3ce49fc4963b9..898977ee2030d99ca792425f22e58464b9ee8a0d 100644 (file)
@@ -1,9 +1,5 @@
 /*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * arch/sh64/kernel/time.c
+ * arch/sh/kernel/time_64.c
  *
  * Copyright (C) 2000, 2001  Paolo Alberelli
  * Copyright (C) 2003 - 2007  Paul Mundt
@@ -13,6 +9,10 @@
  *    Copyright (C) 1999  Tetsuya Okada & Niibe Yutaka
  *      Some code taken from i386 version.
  *      Copyright (C) 1991, 1992, 1995  Linus Torvalds
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
  */
 #include <linux/errno.h>
 #include <linux/rwsem.h>
@@ -229,15 +229,22 @@ static long last_rtc_update;
 static inline void do_timer_interrupt(void)
 {
        unsigned long long current_ctc;
+
+       if (current->pid)
+               profile_tick(CPU_PROFILING);
+
+       /*
+        * Here we are in the timer irq handler. We just have irqs locally
+        * disabled but we don't know if the timer_bh is running on the other
+        * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
+        * the irq version of write_lock because as just said we have irq
+        * locally disabled. -arca
+        */
+       write_lock(&xtime_lock);
        asm ("getcon cr62, %0" : "=r" (current_ctc));
        ctc_last_interrupt = (unsigned long) current_ctc;
 
        do_timer(1);
-#ifndef CONFIG_SMP
-       update_process_times(user_mode(get_irq_regs()));
-#endif
-       if (current->pid)
-               profile_tick(CPU_PROFILING);
 
 #ifdef CONFIG_HEARTBEAT
        if (sh_mv.mv_heartbeat != NULL)
@@ -259,6 +266,11 @@ static inline void do_timer_interrupt(void)
                        /* do it again in 60 s */
                        last_rtc_update = xtime.tv_sec - 600;
        }
+       write_unlock(&xtime_lock);
+
+#ifndef CONFIG_SMP
+       update_process_times(user_mode(get_irq_regs()));
+#endif
 }
 
 /*
@@ -275,16 +287,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
        timer_status &= ~0x100;
        ctrl_outw(timer_status, TMU0_TCR);
 
-       /*
-        * Here we are in the timer irq handler. We just have irqs locally
-        * disabled but we don't know if the timer_bh is running on the other
-        * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
-        * the irq version of write_lock because as just said we have irq
-        * locally disabled. -arca
-        */
-       write_lock(&xtime_lock);
        do_timer_interrupt();
-       write_unlock(&xtime_lock);
 
        return IRQ_HANDLED;
 }