aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc')
-rw-r--r--arch/ppc/kernel/time.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index 1e1f31554767..187388625a76 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -80,8 +80,6 @@ unsigned tb_to_us;
80unsigned tb_last_stamp; 80unsigned tb_last_stamp;
81unsigned long tb_to_ns_scale; 81unsigned long tb_to_ns_scale;
82 82
83extern unsigned long wall_jiffies;
84
85/* used for timezone offset */ 83/* used for timezone offset */
86static long timezone_offset; 84static long timezone_offset;
87 85
@@ -173,8 +171,7 @@ void timer_interrupt(struct pt_regs * regs)
173 */ 171 */
174 if ( ppc_md.set_rtc_time && ntp_synced() && 172 if ( ppc_md.set_rtc_time && ntp_synced() &&
175 xtime.tv_sec - last_rtc_update >= 659 && 173 xtime.tv_sec - last_rtc_update >= 659 &&
176 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && 174 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ) {
177 jiffies - wall_jiffies == 1) {
178 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0) 175 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0)
179 last_rtc_update = xtime.tv_sec+1; 176 last_rtc_update = xtime.tv_sec+1;
180 else 177 else
@@ -200,7 +197,7 @@ void do_gettimeofday(struct timeval *tv)
200{ 197{
201 unsigned long flags; 198 unsigned long flags;
202 unsigned long seq; 199 unsigned long seq;
203 unsigned delta, lost_ticks, usec, sec; 200 unsigned delta, usec, sec;
204 201
205 do { 202 do {
206 seq = read_seqbegin_irqsave(&xtime_lock, flags); 203 seq = read_seqbegin_irqsave(&xtime_lock, flags);
@@ -214,10 +211,9 @@ void do_gettimeofday(struct timeval *tv)
214 if (!smp_tb_synchronized) 211 if (!smp_tb_synchronized)
215 delta = 0; 212 delta = 0;
216#endif /* CONFIG_SMP */ 213#endif /* CONFIG_SMP */
217 lost_ticks = jiffies - wall_jiffies;
218 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 214 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
219 215
220 usec += mulhwu(tb_to_us, tb_ticks_per_jiffy * lost_ticks + delta); 216 usec += mulhwu(tb_to_us, delta);
221 while (usec >= 1000000) { 217 while (usec >= 1000000) {
222 sec++; 218 sec++;
223 usec -= 1000000; 219 usec -= 1000000;
@@ -258,7 +254,6 @@ int do_settimeofday(struct timespec *tv)
258 * still reasonable when gettimeofday resolution is 1 jiffy. 254 * still reasonable when gettimeofday resolution is 1 jiffy.
259 */ 255 */
260 tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id())); 256 tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id()));
261 tb_delta += (jiffies - wall_jiffies) * tb_ticks_per_jiffy;
262 257
263 new_nsec -= 1000 * mulhwu(tb_to_us, tb_delta); 258 new_nsec -= 1000 * mulhwu(tb_to_us, tb_delta);
264 259