diff options
author | Thomas Gleixner <[email protected]> | 2019-06-23 15:23:52 +0200 |
---|---|---|
committer | Thomas Gleixner <[email protected]> | 2019-06-28 00:57:19 +0200 |
commit | 44b5be5733e119300115b98409cbcf9a45b8d3f1 (patch) | |
tree | 197868c64f2ac2686dff250ab00e468e76e9baf9 | |
parent | 3222daf970f30133cc4c639cbecdc29c4ae91b2b (diff) |
x86/hpet: Simplify counter validation
There is no point to loop for 200k TSC cycles to check afterwards whether
the HPET counter is working. Read the counter inside of the loop and break
out when the counter value changed.
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ricardo Neri <[email protected]>
Cc: Ashok Raj <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Suravee Suthikulpanit <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Ravi Shankar <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
-rw-r--r-- | arch/x86/kernel/hpet.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 8c57dbf15e3b..74756c0a3a10 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -853,15 +853,13 @@ static bool __init hpet_counting(void) * 1 GHz == 200us */ do { - rep_nop(); + if (t1 != hpet_readl(HPET_COUNTER)) + return true; now = rdtsc(); } while ((now - start) < 200000UL); - if (t1 == hpet_readl(HPET_COUNTER)) { - pr_warn("Counter not counting. HPET disabled\n"); - return false; - } - return true; + pr_warn("Counter not counting. HPET disabled\n"); + return false; } /** |