diff options
Diffstat (limited to 'arch/i386/kernel/time.c')
-rw-r--r-- | arch/i386/kernel/time.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index 0ee9dee8af06..eefea7c55008 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c | |||
@@ -194,10 +194,7 @@ int do_settimeofday(struct timespec *tv) | |||
194 | set_normalized_timespec(&xtime, sec, nsec); | 194 | set_normalized_timespec(&xtime, sec, nsec); |
195 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | 195 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); |
196 | 196 | ||
197 | time_adjust = 0; /* stop active adjtime() */ | 197 | ntp_clear(); |
198 | time_status |= STA_UNSYNC; | ||
199 | time_maxerror = NTP_PHASE_LIMIT; | ||
200 | time_esterror = NTP_PHASE_LIMIT; | ||
201 | write_sequnlock_irq(&xtime_lock); | 198 | write_sequnlock_irq(&xtime_lock); |
202 | clock_was_set(); | 199 | clock_was_set(); |
203 | return 0; | 200 | return 0; |
@@ -252,8 +249,7 @@ EXPORT_SYMBOL(profile_pc); | |||
252 | * timer_interrupt() needs to keep up the real-time clock, | 249 | * timer_interrupt() needs to keep up the real-time clock, |
253 | * as well as call the "do_timer()" routine every clocktick | 250 | * as well as call the "do_timer()" routine every clocktick |
254 | */ | 251 | */ |
255 | static inline void do_timer_interrupt(int irq, void *dev_id, | 252 | static inline void do_timer_interrupt(int irq, struct pt_regs *regs) |
256 | struct pt_regs *regs) | ||
257 | { | 253 | { |
258 | #ifdef CONFIG_X86_IO_APIC | 254 | #ifdef CONFIG_X86_IO_APIC |
259 | if (timer_ack) { | 255 | if (timer_ack) { |
@@ -307,7 +303,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
307 | 303 | ||
308 | cur_timer->mark_offset(); | 304 | cur_timer->mark_offset(); |
309 | 305 | ||
310 | do_timer_interrupt(irq, NULL, regs); | 306 | do_timer_interrupt(irq, regs); |
311 | 307 | ||
312 | write_sequnlock(&xtime_lock); | 308 | write_sequnlock(&xtime_lock); |
313 | return IRQ_HANDLED; | 309 | return IRQ_HANDLED; |
@@ -348,7 +344,7 @@ static void sync_cmos_clock(unsigned long dummy) | |||
348 | * This code is run on a timer. If the clock is set, that timer | 344 | * This code is run on a timer. If the clock is set, that timer |
349 | * may not expire at the correct time. Thus, we adjust... | 345 | * may not expire at the correct time. Thus, we adjust... |
350 | */ | 346 | */ |
351 | if ((time_status & STA_UNSYNC) != 0) | 347 | if (!ntp_synced()) |
352 | /* | 348 | /* |
353 | * Not synced, exit, do not restart a timer (if one is | 349 | * Not synced, exit, do not restart a timer (if one is |
354 | * running, let it run out). | 350 | * running, let it run out). |
@@ -383,6 +379,7 @@ void notify_arch_cmos_timer(void) | |||
383 | 379 | ||
384 | static long clock_cmos_diff, sleep_start; | 380 | static long clock_cmos_diff, sleep_start; |
385 | 381 | ||
382 | static struct timer_opts *last_timer; | ||
386 | static int timer_suspend(struct sys_device *dev, pm_message_t state) | 383 | static int timer_suspend(struct sys_device *dev, pm_message_t state) |
387 | { | 384 | { |
388 | /* | 385 | /* |
@@ -391,6 +388,10 @@ static int timer_suspend(struct sys_device *dev, pm_message_t state) | |||
391 | clock_cmos_diff = -get_cmos_time(); | 388 | clock_cmos_diff = -get_cmos_time(); |
392 | clock_cmos_diff += get_seconds(); | 389 | clock_cmos_diff += get_seconds(); |
393 | sleep_start = get_cmos_time(); | 390 | sleep_start = get_cmos_time(); |
391 | last_timer = cur_timer; | ||
392 | cur_timer = &timer_none; | ||
393 | if (last_timer->suspend) | ||
394 | last_timer->suspend(state); | ||
394 | return 0; | 395 | return 0; |
395 | } | 396 | } |
396 | 397 | ||
@@ -404,6 +405,7 @@ static int timer_resume(struct sys_device *dev) | |||
404 | if (is_hpet_enabled()) | 405 | if (is_hpet_enabled()) |
405 | hpet_reenable(); | 406 | hpet_reenable(); |
406 | #endif | 407 | #endif |
408 | setup_pit_timer(); | ||
407 | sec = get_cmos_time() + clock_cmos_diff; | 409 | sec = get_cmos_time() + clock_cmos_diff; |
408 | sleep_length = (get_cmos_time() - sleep_start) * HZ; | 410 | sleep_length = (get_cmos_time() - sleep_start) * HZ; |
409 | write_seqlock_irqsave(&xtime_lock, flags); | 411 | write_seqlock_irqsave(&xtime_lock, flags); |
@@ -412,6 +414,11 @@ static int timer_resume(struct sys_device *dev) | |||
412 | write_sequnlock_irqrestore(&xtime_lock, flags); | 414 | write_sequnlock_irqrestore(&xtime_lock, flags); |
413 | jiffies += sleep_length; | 415 | jiffies += sleep_length; |
414 | wall_jiffies += sleep_length; | 416 | wall_jiffies += sleep_length; |
417 | if (last_timer->resume) | ||
418 | last_timer->resume(); | ||
419 | cur_timer = last_timer; | ||
420 | last_timer = NULL; | ||
421 | touch_softlockup_watchdog(); | ||
415 | return 0; | 422 | return 0; |
416 | } | 423 | } |
417 | 424 | ||