Commit 44b5be57 authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Andi Kleen <andi.kleen@intel.com>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Link: https://lkml.kernel.org/r/20190623132435.149535103@linutronix.de
parent 3222daf9
......@@ -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;
}
/**
......
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