diff options
Diffstat (limited to 'arch/xtensa/kernel/time.c')
-rw-r--r-- | arch/xtensa/kernel/time.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 241db201f40e..37347e369987 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c | |||
@@ -26,8 +26,6 @@ | |||
26 | #include <asm/platform.h> | 26 | #include <asm/platform.h> |
27 | 27 | ||
28 | 28 | ||
29 | extern volatile unsigned long wall_jiffies; | ||
30 | |||
31 | DEFINE_SPINLOCK(rtc_lock); | 29 | DEFINE_SPINLOCK(rtc_lock); |
32 | EXPORT_SYMBOL(rtc_lock); | 30 | EXPORT_SYMBOL(rtc_lock); |
33 | 31 | ||
@@ -110,7 +108,6 @@ int do_settimeofday(struct timespec *tv) | |||
110 | */ | 108 | */ |
111 | ccount = get_ccount(); | 109 | ccount = get_ccount(); |
112 | nsec -= (ccount - last_ccount_stamp) * CCOUNT_NSEC; | 110 | nsec -= (ccount - last_ccount_stamp) * CCOUNT_NSEC; |
113 | nsec -= (jiffies - wall_jiffies) * CCOUNT_PER_JIFFY * CCOUNT_NSEC; | ||
114 | 111 | ||
115 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | 112 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); |
116 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | 113 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); |
@@ -129,7 +126,7 @@ EXPORT_SYMBOL(do_settimeofday); | |||
129 | void do_gettimeofday(struct timeval *tv) | 126 | void do_gettimeofday(struct timeval *tv) |
130 | { | 127 | { |
131 | unsigned long flags; | 128 | unsigned long flags; |
132 | unsigned long sec, usec, delta, lost, seq; | 129 | unsigned long sec, usec, delta, seq; |
133 | 130 | ||
134 | do { | 131 | do { |
135 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | 132 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
@@ -137,12 +134,9 @@ void do_gettimeofday(struct timeval *tv) | |||
137 | delta = get_ccount() - last_ccount_stamp; | 134 | delta = get_ccount() - last_ccount_stamp; |
138 | sec = xtime.tv_sec; | 135 | sec = xtime.tv_sec; |
139 | usec = (xtime.tv_nsec / NSEC_PER_USEC); | 136 | usec = (xtime.tv_nsec / NSEC_PER_USEC); |
140 | |||
141 | lost = jiffies - wall_jiffies; | ||
142 | |||
143 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 137 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
144 | 138 | ||
145 | usec += lost * (1000000UL/HZ) + (delta * CCOUNT_NSEC) / NSEC_PER_USEC; | 139 | usec += (delta * CCOUNT_NSEC) / NSEC_PER_USEC; |
146 | for (; usec >= 1000000; sec++, usec -= 1000000) | 140 | for (; usec >= 1000000; sec++, usec -= 1000000) |
147 | ; | 141 | ; |
148 | 142 | ||
@@ -179,8 +173,7 @@ again: | |||
179 | 173 | ||
180 | if (ntp_synced() && | 174 | if (ntp_synced() && |
181 | xtime.tv_sec - last_rtc_update >= 659 && | 175 | xtime.tv_sec - last_rtc_update >= 659 && |
182 | abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ && | 176 | abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ) { |
183 | jiffies - wall_jiffies == 1) { | ||
184 | 177 | ||
185 | if (platform_set_rtc_time(xtime.tv_sec+1) == 0) | 178 | if (platform_set_rtc_time(xtime.tv_sec+1) == 0) |
186 | last_rtc_update = xtime.tv_sec+1; | 179 | last_rtc_update = xtime.tv_sec+1; |