[PATCH] [26/58] x86_64: Use generic xtime init

2007-07-19 Thread Andi Kleen

From: Thomas Gleixner <[EMAIL PROTECTED]>
xtime can be initialized including the cmos update from the generic
timekeeping code. Remove the arch specific implementation.

Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
Signed-off-by: Chris Wright <[EMAIL PROTECTED]>
Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: Andi Kleen <[EMAIL PROTECTED]>

---
 arch/x86_64/kernel/time.c |   40 +---
 1 file changed, 1 insertion(+), 39 deletions(-)

Index: linux/arch/x86_64/kernel/time.c
===
--- linux.orig/arch/x86_64/kernel/time.c
+++ linux/arch/x86_64/kernel/time.c
@@ -193,7 +193,7 @@ static irqreturn_t timer_interrupt(int i
return IRQ_HANDLED;
 }
 
-static unsigned long get_cmos_time(void)
+unsigned long read_persistent_clock(void)
 {
unsigned int year, mon, day, hour, min, sec;
unsigned long flags;
@@ -367,11 +367,6 @@ void __init time_init(void)
 {
if (nohpet)
hpet_address = 0;
-   xtime.tv_sec = get_cmos_time();
-   xtime.tv_nsec = 0;
-
-   set_normalized_timespec(_to_monotonic,
-   -xtime.tv_sec, -xtime.tv_nsec);
 
if (hpet_arch_init())
hpet_address = 0;
@@ -408,54 +403,21 @@ void __init time_init(void)
setup_irq(0, );
 }
 
-
-static long clock_cmos_diff;
-static unsigned long sleep_start;
-
 /*
  * sysfs support for the timer.
  */
 
 static int timer_suspend(struct sys_device *dev, pm_message_t state)
 {
-   /*
-* Estimate time zone so that set_time can update the clock
-*/
-   long cmos_time =  get_cmos_time();
-
-   clock_cmos_diff = -cmos_time;
-   clock_cmos_diff += get_seconds();
-   sleep_start = cmos_time;
return 0;
 }
 
 static int timer_resume(struct sys_device *dev)
 {
-   unsigned long flags;
-   unsigned long sec;
-   unsigned long ctime = get_cmos_time();
-   long sleep_length = (ctime - sleep_start) * HZ;
-
-   if (sleep_length < 0) {
-   printk(KERN_WARNING "Time skew detected in timer resume!\n");
-   /* The time after the resume must not be earlier than the time
-* before the suspend or some nasty things will happen
-*/
-   sleep_length = 0;
-   ctime = sleep_start;
-   }
if (hpet_address)
hpet_reenable();
else
i8254_timer_resume();
-
-   sec = ctime + clock_cmos_diff;
-   write_seqlock_irqsave(_lock,flags);
-   xtime.tv_sec = sec;
-   xtime.tv_nsec = 0;
-   jiffies += sleep_length;
-   write_sequnlock_irqrestore(_lock,flags);
-   touch_softlockup_watchdog();
return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [26/58] x86_64: Use generic xtime init

2007-07-19 Thread Andi Kleen

From: Thomas Gleixner [EMAIL PROTECTED]
xtime can be initialized including the cmos update from the generic
timekeeping code. Remove the arch specific implementation.

Signed-off-by: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: Chris Wright [EMAIL PROTECTED]
Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]

---
 arch/x86_64/kernel/time.c |   40 +---
 1 file changed, 1 insertion(+), 39 deletions(-)

Index: linux/arch/x86_64/kernel/time.c
===
--- linux.orig/arch/x86_64/kernel/time.c
+++ linux/arch/x86_64/kernel/time.c
@@ -193,7 +193,7 @@ static irqreturn_t timer_interrupt(int i
return IRQ_HANDLED;
 }
 
-static unsigned long get_cmos_time(void)
+unsigned long read_persistent_clock(void)
 {
unsigned int year, mon, day, hour, min, sec;
unsigned long flags;
@@ -367,11 +367,6 @@ void __init time_init(void)
 {
if (nohpet)
hpet_address = 0;
-   xtime.tv_sec = get_cmos_time();
-   xtime.tv_nsec = 0;
-
-   set_normalized_timespec(wall_to_monotonic,
-   -xtime.tv_sec, -xtime.tv_nsec);
 
if (hpet_arch_init())
hpet_address = 0;
@@ -408,54 +403,21 @@ void __init time_init(void)
setup_irq(0, irq0);
 }
 
-
-static long clock_cmos_diff;
-static unsigned long sleep_start;
-
 /*
  * sysfs support for the timer.
  */
 
 static int timer_suspend(struct sys_device *dev, pm_message_t state)
 {
-   /*
-* Estimate time zone so that set_time can update the clock
-*/
-   long cmos_time =  get_cmos_time();
-
-   clock_cmos_diff = -cmos_time;
-   clock_cmos_diff += get_seconds();
-   sleep_start = cmos_time;
return 0;
 }
 
 static int timer_resume(struct sys_device *dev)
 {
-   unsigned long flags;
-   unsigned long sec;
-   unsigned long ctime = get_cmos_time();
-   long sleep_length = (ctime - sleep_start) * HZ;
-
-   if (sleep_length  0) {
-   printk(KERN_WARNING Time skew detected in timer resume!\n);
-   /* The time after the resume must not be earlier than the time
-* before the suspend or some nasty things will happen
-*/
-   sleep_length = 0;
-   ctime = sleep_start;
-   }
if (hpet_address)
hpet_reenable();
else
i8254_timer_resume();
-
-   sec = ctime + clock_cmos_diff;
-   write_seqlock_irqsave(xtime_lock,flags);
-   xtime.tv_sec = sec;
-   xtime.tv_nsec = 0;
-   jiffies += sleep_length;
-   write_sequnlock_irqrestore(xtime_lock,flags);
-   touch_softlockup_watchdog();
return 0;
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/