aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm26/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm26/kernel/time.c')
-rw-r--r--arch/arm26/kernel/time.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c
index 80adbd005fc5..1206469b2b86 100644
--- a/arch/arm26/kernel/time.c
+++ b/arch/arm26/kernel/time.c
@@ -33,8 +33,6 @@
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/ioc.h> 34#include <asm/ioc.h>
35 35
36extern unsigned long wall_jiffies;
37
38/* this needs a better home */ 36/* this needs a better home */
39DEFINE_SPINLOCK(rtc_lock); 37DEFINE_SPINLOCK(rtc_lock);
40 38
@@ -136,16 +134,11 @@ void do_gettimeofday(struct timeval *tv)
136{ 134{
137 unsigned long flags; 135 unsigned long flags;
138 unsigned long seq; 136 unsigned long seq;
139 unsigned long usec, sec, lost; 137 unsigned long usec, sec;
140 138
141 do { 139 do {
142 seq = read_seqbegin_irqsave(&xtime_lock, flags); 140 seq = read_seqbegin_irqsave(&xtime_lock, flags);
143 usec = gettimeoffset(); 141 usec = gettimeoffset();
144
145 lost = jiffies - wall_jiffies;
146 if (lost)
147 usec += lost * USECS_PER_JIFFY;
148
149 sec = xtime.tv_sec; 142 sec = xtime.tv_sec;
150 usec += xtime.tv_nsec / 1000; 143 usec += xtime.tv_nsec / 1000;
151 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 144 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -174,8 +167,7 @@ int do_settimeofday(struct timespec *tv)
174 * wall time. Discover what correction gettimeofday() would have 167 * wall time. Discover what correction gettimeofday() would have
175 * done, and then undo it! 168 * done, and then undo it!
176 */ 169 */
177 tv->tv_nsec -= 1000 * (gettimeoffset() + 170 tv->tv_nsec -= 1000 * gettimeoffset();
178 (jiffies - wall_jiffies) * USECS_PER_JIFFY);
179 171
180 while (tv->tv_nsec < 0) { 172 while (tv->tv_nsec < 0) {
181 tv->tv_nsec += NSEC_PER_SEC; 173 tv->tv_nsec += NSEC_PER_SEC;