Commit 5329e13d authored by Jan Beulich's avatar Jan Beulich Committed by Linus Torvalds

[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: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bdf2b1c9
...@@ -504,8 +504,8 @@ unsigned long long sched_clock(void) ...@@ -504,8 +504,8 @@ unsigned long long sched_clock(void)
static unsigned long get_cmos_time(void) static unsigned long get_cmos_time(void)
{ {
unsigned int timeout, year, mon, day, hour, min, sec; unsigned int timeout = 1000000, year, mon, day, hour, min, sec;
unsigned char last, this; unsigned char uip = 0, this = 0;
unsigned long flags; unsigned long flags;
/* /*
...@@ -518,11 +518,8 @@ static unsigned long get_cmos_time(void) ...@@ -518,11 +518,8 @@ static unsigned long get_cmos_time(void)
spin_lock_irqsave(&rtc_lock, flags); spin_lock_irqsave(&rtc_lock, flags);
timeout = 1000000; while (timeout && (!uip || this)) {
last = this = 0; uip |= this;
while (timeout && last && !this) {
last = this;
this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP;
timeout--; timeout--;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment