Re: [PATCH 8/8] i2c: nomadik: reduce FIFO flush timeout to avoid long interrupt handling

From: Wolfram Sang

Date: Sun Nov 08 2026 - 05:19:33 EST



> > In flush_i2c_fifo(), the driver sets FTX and FRX flags and waits until
> > they are reset (these bits are self-clearing). If after the first read
> > one or both of these bits is set, it waits until both are reset. The
> > timeout is 10 * I2C transfer timeout. I2C transfer timeout is by default
> > 200 milliseconds. 2 seconds are much more than needed: as stated in the
> > comment above, the flushing operation takes just several cycles before
> > completed.
> >
> > flush_i2c_fifo() is called from init_hw() that may be called from
> > interrupt handler. So, if the I2C controller is stuck and the FIFO does
> > not get flushed, the CPU may spend up to 2 seconds in the interrupt
> > handler and cause watchdog timeout or other unwanted consequences.
> > Moreover, if the interrupt is handled by the same CPU core that updates
> > jiffies, the loop may not finish at all.
> >
> > To avoid too long waiting, reduce the timeout to 100 microseconds and
> > use read_poll_timeout_atomic() instead of relying on jiffies.
> >
> > Fixes: 3f9900f17cdb ("i2c: Add support for Ux500/Nomadik I2C controller")
>
> Is it really "fixing" that? I don't know if I agree that this is an error
> in the initial submission in 2010...

Removed it.

> > Signed-off-by: Dmitry Guzman <Dmitry.Guzman@xxxxxxxxxxxx>
>
> Surplus newline above? Maintainer can remove it when applying.

Fixed this.

Thanks for the reviews, Linus.