public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Martin Aberer <martin.aberer@bachmann.info>,
	peter@korsgaard.com,  linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: ocores: Use read_poll_timeout_atomic to avoid false poll timeouts
Date: Fri, 27 Mar 2026 15:03:44 +0100	[thread overview]
Message-ID: <acaMqaKYy6mctA2S@zenone.zhora.eu> (raw)
In-Reply-To: <c9afbdf9-d5ce-4f1c-8192-5d3baebe125c@lunn.ch>

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

  reply	other threads:[~2026-03-27 14:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 13:52 [PATCH] i2c: ocores: re-check status after poll timeout to avoid false errors Martin Aberer
2026-03-23 14:34 ` Christian Gmeiner
2026-03-23 15:12   ` Andrew Lunn
2026-03-24 14:05 ` [PATCH] i2c: ocores: Use read_poll_timeout_atomic to avoid false poll timeouts Martin Aberer
2026-03-26 22:34   ` Andi Shyti
2026-03-27  0:27   ` Andrew Lunn
2026-03-27 14:03     ` Andi Shyti [this message]
2026-03-27 14:05       ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acaMqaKYy6mctA2S@zenone.zhora.eu \
    --to=andi.shyti@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.aberer@bachmann.info \
    --cc=peter@korsgaard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox