aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-07-21 11:10:12 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-21 21:37:08 -0400
commitef81ab2c72e6979367612502fefbb18669e37879 (patch)
tree2cf212f5c4196b36c3518ded4a9b210cd5ef1749 /arch/x86_64
parentaf74522ab782c718783b9d85d6d53b8cbf0c7b17 (diff)
x86_64: Use generic xtime init
xtime can be initialized including the cmos update from the generic timekeeping code. Remove the arch specific implementation. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/time.c40
1 files changed, 1 insertions, 39 deletions
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index d0e014e4d9c4..8dc6f2173597 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -193,7 +193,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
193 return IRQ_HANDLED; 193 return IRQ_HANDLED;
194} 194}
195 195
196static unsigned long get_cmos_time(void) 196unsigned long read_persistent_clock(void)
197{ 197{
198 unsigned int year, mon, day, hour, min, sec; 198 unsigned int year, mon, day, hour, min, sec;
199 unsigned long flags; 199 unsigned long flags;
@@ -367,11 +367,6 @@ void __init time_init(void)
367{ 367{
368 if (nohpet) 368 if (nohpet)
369 hpet_address = 0; 369 hpet_address = 0;
370 xtime.tv_sec = get_cmos_time();
371 xtime.tv_nsec = 0;
372
373 set_normalized_timespec(&wall_to_monotonic,
374 -xtime.tv_sec, -xtime.tv_nsec);
375 370
376 if (hpet_arch_init()) 371 if (hpet_arch_init())
377 hpet_address = 0; 372 hpet_address = 0;
@@ -409,54 +404,21 @@ void __init time_init(void)
409 setup_irq(0, &irq0); 404 setup_irq(0, &irq0);
410} 405}
411 406
412
413static long clock_cmos_diff;
414static unsigned long sleep_start;
415
416/* 407/*
417 * sysfs support for the timer. 408 * sysfs support for the timer.
418 */ 409 */
419 410
420static int timer_suspend(struct sys_device *dev, pm_message_t state) 411static int timer_suspend(struct sys_device *dev, pm_message_t state)
421{ 412{
422 /*
423 * Estimate time zone so that set_time can update the clock
424 */
425 long cmos_time = get_cmos_time();
426
427 clock_cmos_diff = -cmos_time;
428 clock_cmos_diff += get_seconds();
429 sleep_start = cmos_time;
430 return 0; 413 return 0;
431} 414}
432 415
433static int timer_resume(struct sys_device *dev) 416static int timer_resume(struct sys_device *dev)
434{ 417{
435 unsigned long flags;
436 unsigned long sec;
437 unsigned long ctime = get_cmos_time();
438 long sleep_length = (ctime - sleep_start) * HZ;
439
440 if (sleep_length < 0) {
441 printk(KERN_WARNING "Time skew detected in timer resume!\n");
442 /* The time after the resume must not be earlier than the time
443 * before the suspend or some nasty things will happen
444 */
445 sleep_length = 0;
446 ctime = sleep_start;
447 }
448 if (hpet_address) 418 if (hpet_address)
449 hpet_reenable(); 419 hpet_reenable();
450 else 420 else
451 i8254_timer_resume(); 421 i8254_timer_resume();
452
453 sec = ctime + clock_cmos_diff;
454 write_seqlock_irqsave(&xtime_lock,flags);
455 xtime.tv_sec = sec;
456 xtime.tv_nsec = 0;
457 jiffies += sleep_length;
458 write_sequnlock_irqrestore(&xtime_lock,flags);
459 touch_softlockup_watchdog();
460 return 0; 422 return 0;
461} 423}
462 424