Commit 18ed61da authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
parent c8bc6f3c
...@@ -384,11 +384,22 @@ static int hpet_next_event(unsigned long delta, ...@@ -384,11 +384,22 @@ static int hpet_next_event(unsigned long delta,
hpet_writel(cnt, HPET_Tn_CMP(timer)); hpet_writel(cnt, HPET_Tn_CMP(timer));
/* /*
* We need to read back the CMP register to make sure that * We need to read back the CMP register on certain HPET
* what we wrote hit the chip before we compare it to the * implementations (ATI chipsets) which seem to delay the
* counter. * transfer of the compare register into the internal compare
* logic. With small deltas this might actually be too late as
* the counter could already be higher than the compare value
* at that point and we would wait for the next hpet interrupt
* forever. We found out that reading the CMP register back
* forces the transfer so we can rely on the comparison with
* the counter register below. If the read back from the
* compare register does not match the value we programmed
* then we might have a real hardware problem. We can not do
* much about it here, but at least alert the user/admin with
* a prominent warning.
*/ */
WARN_ON_ONCE(hpet_readl(HPET_Tn_CMP(timer)) != cnt); WARN_ONCE(hpet_readl(HPET_Tn_CMP(timer)) != cnt,
KERN_WARNING "hpet: compare register read back failed.\n");
return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;
} }
......
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