Re: [PATCH] i2c: ocores: Use read_poll_timeout_atomic to avoid false poll timeouts
From: Andi Shyti
Date: Fri Mar 27 2026 - 10:09:12 EST
Hi,
On Fri, Mar 27, 2026 at 01:27:16AM +0100, Andrew Lunn wrote:
> On Tue, Mar 24, 2026 at 03:05:56PM +0100, Martin Aberer wrote:
> > Replace the manual polling loop in ocores_wait() with the kernel helper
> > read_poll_timeout_atomic(). This simplifies the code and ensures robust
> > timeout handling. By using this helper, we avoid spurious timeout errors
> > that could occur under high CPU load or preemption, as the macro handles
> > timing and condition checks atomically.
>
> It is not that it does it atomically, but that it always does a check
> after the delay, even if the delay has taken us past the timeout.
I took the liberty of changing the commit log to this:
i2c: ocores: Use read_poll_timeout_atomic to avoid false poll timeouts
Replace the manual polling loop in ocores_wait() with the kernel helper
read_poll_timeout_atomic(). This simplifies the code and ensures robust
timeout handling.
In particular, the helper guarantees a condition check after the
delay, even if the delay exceeds the timeout, avoiding spurious
timeout errors under load or preemption.
Let me know if it doesn't work.
I merged the patch to i2c/i2c-host.
Thanks,
Andi