aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjohn stultz <johnstul@us.ibm.com>2006-09-26 02:32:35 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:57 -0400
commitc7f40ff15aba95bc09a759024d62b2c344ef0856 (patch)
treecccf693193af5253127726172461f5910f349e74
parent0f0f1b400ce3c4780b9d974bc69e8b558d99aba4 (diff)
[PATCH] i386: Kill references to xtime
Remove all references to xtime in i386 and replace them w/ get/set_timeofday(). Requires some ugly and uncertain changes to APM, but has been lightly tested to work. Signed-off-by: John Stultz <johnstul@us.ibm.com> Acked-by: Ingo Molnar <mingo@elte.hu> Acked-by: Mikael Pettersson <mikpe@it.uu.se> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/i386/kernel/apm.c17
-rw-r--r--arch/i386/kernel/time.c26
2 files changed, 20 insertions, 23 deletions
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 24fd577861f1..ff9ce4b5eaa8 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -1154,9 +1154,11 @@ out:
1154 1154
1155static void set_time(void) 1155static void set_time(void)
1156{ 1156{
1157 struct timespec ts;
1157 if (got_clock_diff) { /* Must know time zone in order to set clock */ 1158 if (got_clock_diff) { /* Must know time zone in order to set clock */
1158 xtime.tv_sec = get_cmos_time() + clock_cmos_diff; 1159 ts.tv_sec = get_cmos_time() + clock_cmos_diff;
1159 xtime.tv_nsec = 0; 1160 ts.tv_nsec = 0;
1161 do_settimeofday(&ts);
1160 } 1162 }
1161} 1163}
1162 1164
@@ -1232,13 +1234,8 @@ static int suspend(int vetoable)
1232 restore_processor_state(); 1234 restore_processor_state();
1233 1235
1234 local_irq_disable(); 1236 local_irq_disable();
1235 write_seqlock(&xtime_lock);
1236 spin_lock(&i8253_lock);
1237 reinit_timer();
1238 set_time(); 1237 set_time();
1239 1238 reinit_timer();
1240 spin_unlock(&i8253_lock);
1241 write_sequnlock(&xtime_lock);
1242 1239
1243 if (err == APM_NO_ERROR) 1240 if (err == APM_NO_ERROR)
1244 err = APM_SUCCESS; 1241 err = APM_SUCCESS;
@@ -1365,9 +1362,7 @@ static void check_events(void)
1365 ignore_bounce = 1; 1362 ignore_bounce = 1;
1366 if ((event != APM_NORMAL_RESUME) 1363 if ((event != APM_NORMAL_RESUME)
1367 || (ignore_normal_resume == 0)) { 1364 || (ignore_normal_resume == 0)) {
1368 write_seqlock_irq(&xtime_lock);
1369 set_time(); 1365 set_time();
1370 write_sequnlock_irq(&xtime_lock);
1371 device_resume(); 1366 device_resume();
1372 pm_send_all(PM_RESUME, (void *)0); 1367 pm_send_all(PM_RESUME, (void *)0);
1373 queue_event(event, NULL); 1368 queue_event(event, NULL);
@@ -1383,9 +1378,7 @@ static void check_events(void)
1383 break; 1378 break;
1384 1379
1385 case APM_UPDATE_TIME: 1380 case APM_UPDATE_TIME:
1386 write_seqlock_irq(&xtime_lock);
1387 set_time(); 1381 set_time();
1388 write_sequnlock_irq(&xtime_lock);
1389 break; 1382 break;
1390 1383
1391 case APM_CRITICAL_SUSPEND: 1384 case APM_CRITICAL_SUSPEND:
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index edd00f6cee37..6f333e7fb23c 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -288,7 +288,7 @@ static int timer_resume(struct sys_device *dev)
288 unsigned long flags; 288 unsigned long flags;
289 unsigned long sec; 289 unsigned long sec;
290 unsigned long sleep_length; 290 unsigned long sleep_length;
291 291 struct timespec ts;
292#ifdef CONFIG_HPET_TIMER 292#ifdef CONFIG_HPET_TIMER
293 if (is_hpet_enabled()) 293 if (is_hpet_enabled())
294 hpet_reenable(); 294 hpet_reenable();
@@ -296,9 +296,11 @@ static int timer_resume(struct sys_device *dev)
296 setup_pit_timer(); 296 setup_pit_timer();
297 sec = get_cmos_time() + clock_cmos_diff; 297 sec = get_cmos_time() + clock_cmos_diff;
298 sleep_length = (get_cmos_time() - sleep_start) * HZ; 298 sleep_length = (get_cmos_time() - sleep_start) * HZ;
299
300 ts.tv_sec = sec;
301 ts.tv_nsec = 0;
302 do_settimeofday(&ts);
299 write_seqlock_irqsave(&xtime_lock, flags); 303 write_seqlock_irqsave(&xtime_lock, flags);
300 xtime.tv_sec = sec;
301 xtime.tv_nsec = 0;
302 jiffies_64 += sleep_length; 304 jiffies_64 += sleep_length;
303 wall_jiffies += sleep_length; 305 wall_jiffies += sleep_length;
304 write_sequnlock_irqrestore(&xtime_lock, flags); 306 write_sequnlock_irqrestore(&xtime_lock, flags);
@@ -334,10 +336,11 @@ extern void (*late_time_init)(void);
334/* Duplicate of time_init() below, with hpet_enable part added */ 336/* Duplicate of time_init() below, with hpet_enable part added */
335static void __init hpet_time_init(void) 337static void __init hpet_time_init(void)
336{ 338{
337 xtime.tv_sec = get_cmos_time(); 339 struct timespec ts;
338 xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); 340 ts.tv_sec = get_cmos_time();
339 set_normalized_timespec(&wall_to_monotonic, 341 ts.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
340 -xtime.tv_sec, -xtime.tv_nsec); 342
343 do_settimeofday(&ts);
341 344
342 if ((hpet_enable() >= 0) && hpet_use_timer) { 345 if ((hpet_enable() >= 0) && hpet_use_timer) {
343 printk("Using HPET for base-timer\n"); 346 printk("Using HPET for base-timer\n");
@@ -349,6 +352,7 @@ static void __init hpet_time_init(void)
349 352
350void __init time_init(void) 353void __init time_init(void)
351{ 354{
355 struct timespec ts;
352#ifdef CONFIG_HPET_TIMER 356#ifdef CONFIG_HPET_TIMER
353 if (is_hpet_capable()) { 357 if (is_hpet_capable()) {
354 /* 358 /*
@@ -359,10 +363,10 @@ void __init time_init(void)
359 return; 363 return;
360 } 364 }
361#endif 365#endif
362 xtime.tv_sec = get_cmos_time(); 366 ts.tv_sec = get_cmos_time();
363 xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); 367 ts.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
364 set_normalized_timespec(&wall_to_monotonic, 368
365 -xtime.tv_sec, -xtime.tv_nsec); 369 do_settimeofday(&ts);
366 370
367 time_init_hook(); 371 time_init_hook();
368} 372}