]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc/kernel/time.c
USB: MUSB: Better sysconf reg settings on PM point of view
[linux-2.6-omap-h63xx.git] / arch / sparc / kernel / time.c
index 4bf78a5e8e0f8f16bdbf7277eb31f817cb8c942f..53caacbb3982e20c3feb464facdbe10352122dcf 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: time.c,v 1.60 2002/01/23 14:33:55 davem Exp $
- * linux/arch/sparc/kernel/time.c
+/* linux/arch/sparc/kernel/time.c
  *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
  * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
  *
  * Chris Davis (cdavis@cois.on.ca) 03/27/1998
@@ -106,7 +105,7 @@ __volatile__ unsigned int *master_l10_limit;
 
 #define TICK_SIZE (tick_nsec / 1000)
 
-irqreturn_t timer_interrupt(int irq, void *dev_id)
+static irqreturn_t timer_interrupt(int dummy, void *dev_id)
 {
        /* last time the cmos clock got updated */
        static long last_rtc_update;
@@ -129,10 +128,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
        clear_clock_irq();
 
        do_timer(1);
-#ifndef CONFIG_SMP
-       update_process_times(user_mode(get_irq_regs()));
-#endif
-
 
        /* Determine when to update the Mostek clock. */
        if (ntp_synced() &&
@@ -146,6 +141,9 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
        }
        write_sequnlock(&xtime_lock);
 
+#ifndef CONFIG_SMP
+       update_process_times(user_mode(get_irq_regs()));
+#endif
        return IRQ_HANDLED;
 }
 
@@ -210,7 +208,7 @@ static void __devinit kick_start_clock(void)
 }
 
 /* Return nonzero if the clock chip battery is low. */
-static __inline__ int has_low_battery(void)
+static inline int has_low_battery(void)
 {
        struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs;
        unsigned char data1, data2;
@@ -252,7 +250,7 @@ static void __devinit mostek_set_system_time(void)
 }
 
 /* Probe for the real time clock chip on Sun4 */
-static __inline__ void sun4_clock_probe(void)
+static inline void sun4_clock_probe(void)
 {
 #ifdef CONFIG_SUN4
        int temp;
@@ -437,7 +435,14 @@ void __init time_init(void)
 
 static inline unsigned long do_gettimeoffset(void)
 {
-       return (*master_l10_counter >> 10) & 0x1fffff;
+       unsigned long val = *master_l10_counter;
+       unsigned long usec = (val >> 10) & 0x1fffff;
+
+       /* Limit hit?  */
+       if (val & 0x80000000)
+               usec += 1000000 / HZ;
+
+       return usec;
 }
 
 /* Ok, my cute asm atomicity trick doesn't work anymore.