drivers/timer/cavs_timer: Fix race in k_cycle_get_64()
In commit 918a574c ("clock: add k_cycle_get_64") this driver was augmented with a count64() method to get a 64 bit cycle output from the two-32-bit-word device registers. Unfortunately it appeared to be trying to use a spinlock around the two (low/high) reads to protect against overflow. But that doesn't work: spinlocks protect against other CPU code using the same spinlock, not against a hardware counter that is incrementing in real time! Thankfully there was already a count() routine in place that does a detect-overflow-and-retry loop to solve this. Use that. Signed-off-by:Andy Ross <andrew.j.ross@intel.com>
Loading
Please sign in to comment