aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2006-01-11 16:46:42 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 22:05:03 -0500
commit5329e13d0bd82e13814050eb9facb25eedde4bbc (patch)
treeec62d8058882edc85caaab3559a85ac1ffa30bf8 /arch
parentbdf2b1c9fedf76a1797216559f221e5eaa7a1eab (diff)
[PATCH] x86_64: Fix get_cmos_time()
Due to a broken condition, the body of the loop that is intended to wait for the Update-In-Progress bit to get set and then cleared again was never entered; in fact, the entire loop was optimized out by the compiler. Here is a change to fix the condition (and to also move the initialization of locals out of the spin lock protected region). Signed-Off-By: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/kernel/time.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 966d1376b592..f8c47c688443 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -504,8 +504,8 @@ unsigned long long sched_clock(void)
504 504
505static unsigned long get_cmos_time(void) 505static unsigned long get_cmos_time(void)
506{ 506{
507 unsigned int timeout, year, mon, day, hour, min, sec; 507 unsigned int timeout = 1000000, year, mon, day, hour, min, sec;
508 unsigned char last, this; 508 unsigned char uip = 0, this = 0;
509 unsigned long flags; 509 unsigned long flags;
510 510
511/* 511/*
@@ -518,11 +518,8 @@ static unsigned long get_cmos_time(void)
518 518
519 spin_lock_irqsave(&rtc_lock, flags); 519 spin_lock_irqsave(&rtc_lock, flags);
520 520
521 timeout = 1000000; 521 while (timeout && (!uip || this)) {
522 last = this = 0; 522 uip |= this;
523
524 while (timeout && last && !this) {
525 last = this;
526 this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; 523 this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP;
527 timeout--; 524 timeout--;
528 } 525 }