return retval;
}
-static long clock_cmos_diff, sleep_start;
+static long clock_cmos_diff;
-static int timer_suspend(struct sys_device *dev, u32 state)
+static int time_suspend(struct sys_device *dev, u32 state)
{
/*
* Estimate time zone so that set_time can update the clock
*/
clock_cmos_diff = -get_cmos_time();
clock_cmos_diff += get_seconds();
- sleep_start = get_cmos_time();
return 0;
}
-static int timer_resume(struct sys_device *dev)
+static int time_resume(struct sys_device *dev)
{
unsigned long flags;
- unsigned long sec;
- unsigned long sleep_length;
-
-#ifdef CONFIG_HPET_TIMER
- if (is_hpet_enabled())
- hpet_reenable();
-#endif
- sec = get_cmos_time() + clock_cmos_diff;
- sleep_length = get_cmos_time() - sleep_start;
+ unsigned long sec = get_cmos_time() + clock_cmos_diff;
write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = sec;
xtime.tv_nsec = 0;
write_sequnlock_irqrestore(&xtime_lock, flags);
- jiffies += sleep_length * HZ;
return 0;
}
-static struct sysdev_class timer_sysclass = {
- .resume = timer_resume,
- .suspend = timer_suspend,
- set_kset_name("timer"),
+static struct sysdev_class pit_sysclass = {
+ .resume = time_resume,
+ .suspend = time_suspend,
+ set_kset_name("pit"),
};
/* XXX this driverfs stuff should probably go elsewhere later -john */
-static struct sys_device device_timer = {
+static struct sys_device device_i8253 = {
.id = 0,
- .cls = &timer_sysclass,
+ .cls = &pit_sysclass,
};
static int time_init_device(void)
{
- int error = sysdev_class_register(&timer_sysclass);
+ int error = sysdev_class_register(&pit_sysclass);
if (!error)
- error = sysdev_register(&device_timer);
+ error = sysdev_register(&device_i8253);
return error;
}
void __init hpet_time_init(void)
{
xtime.tv_sec = get_cmos_time();
+ wall_to_monotonic.tv_sec = -xtime.tv_sec;
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
- set_normalized_timespec(&wall_to_monotonic,
- -xtime.tv_sec, -xtime.tv_nsec);
+ wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
if (hpet_enable() >= 0) {
printk("Using HPET for base-timer\n");
}
#endif
xtime.tv_sec = get_cmos_time();
+ wall_to_monotonic.tv_sec = -xtime.tv_sec;
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
- set_normalized_timespec(&wall_to_monotonic,
- -xtime.tv_sec, -xtime.tv_nsec);
+ wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
cur_timer = select_timer();
printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);