time: Clean up warp_clock()
authorJohn Stultz <johnstul@us.ibm.com>
Thu, 11 Mar 2010 22:04:47 +0000 (14:04 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 12 Mar 2010 21:40:42 +0000 (22:40 +0100)
warp_clock() currently accesses timekeeping internal state directly, which
is unnecessary.  Convert it to use the proper timekeeping interfaces.

Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/time.c

index 804798005d19846d449fcb5b2b81439135c6c62a..2358a3646a63b7438cea3787528c9f33c2d1aa9b 100644 (file)
@@ -133,12 +133,11 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
  */
 static inline void warp_clock(void)
 {
-       write_seqlock_irq(&xtime_lock);
-       wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60;
-       xtime.tv_sec += sys_tz.tz_minuteswest * 60;
-       update_xtime_cache(0);
-       write_sequnlock_irq(&xtime_lock);
-       clock_was_set();
+       struct timespec delta, adjust;
+       delta.tv_sec = sys_tz.tz_minuteswest * 60;
+       delta.tv_nsec = 0;
+       adjust = timespec_add_safe(current_kernel_time(), delta);
+       do_settimeofday(&adjust);
 }
 
 /*