diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-11-27 09:24:44 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-11-27 14:37:41 -0500 |
commit | 18ed61da985c57eea3fe8038b13fa2837c9b3c3f (patch) | |
tree | 76f4088ded6203e981438b53b04317f73f27a82b | |
parent | c8bc6f3c806f1fcbfdbf0b1ff6c52dba59192d3b (diff) |
x86: hpet: Make WARN_ON understandable
Andrew complained rightly that the WARN_ON in hpet_next_event() is
confusing and the code comment not really helpful.
Change it to WARN_ONCE and print the reason in clear text. Change the
comment to explain what kind of hardware wreckage we deal with.
Pointed-out-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
-rw-r--r-- | arch/x86/kernel/hpet.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 7f024ff47d1d..ba6e65884603 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -384,11 +384,22 @@ static int hpet_next_event(unsigned long delta, | |||
384 | hpet_writel(cnt, HPET_Tn_CMP(timer)); | 384 | hpet_writel(cnt, HPET_Tn_CMP(timer)); |
385 | 385 | ||
386 | /* | 386 | /* |
387 | * We need to read back the CMP register to make sure that | 387 | * We need to read back the CMP register on certain HPET |
388 | * what we wrote hit the chip before we compare it to the | 388 | * implementations (ATI chipsets) which seem to delay the |
389 | * counter. | 389 | * transfer of the compare register into the internal compare |
390 | * logic. With small deltas this might actually be too late as | ||
391 | * the counter could already be higher than the compare value | ||
392 | * at that point and we would wait for the next hpet interrupt | ||
393 | * forever. We found out that reading the CMP register back | ||
394 | * forces the transfer so we can rely on the comparison with | ||
395 | * the counter register below. If the read back from the | ||
396 | * compare register does not match the value we programmed | ||
397 | * then we might have a real hardware problem. We can not do | ||
398 | * much about it here, but at least alert the user/admin with | ||
399 | * a prominent warning. | ||
390 | */ | 400 | */ |
391 | WARN_ON_ONCE(hpet_readl(HPET_Tn_CMP(timer)) != cnt); | 401 | WARN_ONCE(hpet_readl(HPET_Tn_CMP(timer)) != cnt, |
402 | KERN_WARNING "hpet: compare register read back failed.\n"); | ||
392 | 403 | ||
393 | return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; | 404 | return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; |
394 | } | 405 | } |