]> err.no Git - linux-2.6/blobdiff - arch/parisc/kernel/time.c
[PARISC] Fix do_gettimeofday() hang
[linux-2.6] / arch / parisc / kernel / time.c
index 7ff67f8e9f8c019bd2132cef0e3cabf6768859d9..eb35e1c0bb532b679b660351fc5e28db1e6ee8b8 100644 (file)
 
 #include <linux/timex.h>
 
-u64 jiffies_64 = INITIAL_JIFFIES;
-
-EXPORT_SYMBOL(jiffies_64);
-
 /* xtime and wall_jiffies keep wall-clock time */
 extern unsigned long wall_jiffies;
 
-static long clocktick; /* timer cycles per tick */
-static long halftick;
+static long clocktick __read_mostly;   /* timer cycles per tick */
+static long halftick __read_mostly;
 
 #ifdef CONFIG_SMP
 extern void smp_do_timer(struct pt_regs *regs);
@@ -89,14 +85,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                }
        }
     
-#ifdef CONFIG_CHASSIS_LCD_LED
-       /* Only schedule the led tasklet on cpu 0, and only if it
-        * is enabled.
-        */
-       if (cpu == 0 && !atomic_read(&led_tasklet.count))
-               tasklet_schedule(&led_tasklet);
-#endif
-
        /* check soft power switch status */
        if (cpu == 0 && !atomic_read(&power_tasklet.count))
                tasklet_schedule(&power_tasklet);
@@ -104,6 +92,24 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        return IRQ_HANDLED;
 }
 
+
+unsigned long profile_pc(struct pt_regs *regs)
+{
+       unsigned long pc = instruction_pointer(regs);
+
+       if (regs->gr[0] & PSW_N)
+               pc -= 4;
+
+#ifdef CONFIG_SMP
+       if (in_lock_functions(pc))
+               pc = regs->gr[2];
+#endif
+
+       return pc;
+}
+EXPORT_SYMBOL(profile_pc);
+
+
 /*** converted from ia64 ***/
 /*
  * Return the number of micro-seconds that elapsed since the last
@@ -151,8 +157,22 @@ do_gettimeofday (struct timeval *tv)
                usec += (xtime.tv_nsec / 1000);
        } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
 
-       while (usec >= 1000000) {
-               usec -= 1000000;
+       if (unlikely(usec > LONG_MAX)) {
+               /* This can happen if the gettimeoffset adjustment is
+                * negative and xtime.tv_nsec is smaller than the
+                * adjustment */
+               printk(KERN_ERR "do_gettimeofday() spurious xtime.tv_nsec of %ld\n", usec);
+               usec += USEC_PER_SEC;
+               --sec;
+               /* This should never happen, it means the negative
+                * time adjustment was more than a second, so there's
+                * something seriously wrong */
+               BUG_ON(usec > LONG_MAX);
+       }
+
+
+       while (usec >= USEC_PER_SEC) {
+               usec -= USEC_PER_SEC;
                ++sec;
        }