Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / arch / um / kernel / time.c
index b1f8b0752419d8514763d6ca297674e6e7ceb03e..cd7349de8ca63b9f2435895bd3c71e7baf1cbbe6 100644 (file)
@@ -18,7 +18,6 @@
 #include "asm/param.h"
 #include "asm/current.h"
 #include "kern_util.h"
-#include "user_util.h"
 #include "mode.h"
 #include "os.h"
 
@@ -35,8 +34,8 @@ unsigned long long sched_clock(void)
        return (unsigned long long)jiffies_64 * (1000000000 / HZ);
 }
 
-static unsigned long long prev_nsecs[NR_CPUS];
 #ifdef CONFIG_UML_REAL_TIME_CLOCK
+static unsigned long long prev_nsecs[NR_CPUS];
 static long long delta[NR_CPUS];               /* Deviation per interval */
 #endif
 
@@ -95,7 +94,12 @@ irqreturn_t um_timer(int irq, void *dev)
 
        do_timer(1);
 
+#ifdef CONFIG_UML_REAL_TIME_CLOCK
        nsecs = get_time();
+#else
+       nsecs = (unsigned long long) xtime.tv_sec * BILLION + xtime.tv_nsec +
+               BILLION / HZ;
+#endif
        xtime.tv_sec = nsecs / NSEC_PER_SEC;
        xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC;
 
@@ -128,13 +132,18 @@ void time_init(void)
        nsecs = os_nsecs();
        set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
                                -nsecs % BILLION);
+       set_normalized_timespec(&xtime, nsecs / BILLION, nsecs % BILLION);
        late_time_init = register_timer;
 }
 
 void do_gettimeofday(struct timeval *tv)
 {
+#ifdef CONFIG_UML_REAL_TIME_CLOCK
        unsigned long long nsecs = get_time();
-
+#else
+       unsigned long long nsecs = (unsigned long long) xtime.tv_sec * BILLION +
+               xtime.tv_nsec;
+#endif
        tv->tv_sec = nsecs / NSEC_PER_SEC;
        /* Careful about calculations here - this was originally done as
         * (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC