[PATCH v3 2/2] i2c: i2c-xiic: fix waiting/clearing while atomic
Thilo Zirnstein
thi.zirnstein at gmail.com
Mon Nov 2 01:04:45 PST 2026
Hi Shubhrajyoti,
Thanks for your review.
On Fri, Oct 30, 2026 at 08:16:34PM +0530, Shubhrajyoti Datta wrote:
> On Fri, Oct 16, 2026 at 6:24 PM Thilo Zirnstein <thi.zirnstein at gmail.com> wrote:
> >
> > Use non jiffies based waiting functions,
> > if in atomic context.
> >
> > Suggested-by: Andi Shyti <andi.shyti at kernel.org>
> > Signed-off-by: Thilo Zirnstein <thi.zirnstein at gmail.com>
> > ---
> > drivers/i2c/busses/i2c-xiic.c | 28 +++++++++++++++++++++++-----
> > 1 file changed, 23 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> > index e68e17bdf0ba..fc9a0628cb67 100644
> > --- a/drivers/i2c/busses/i2c-xiic.c
> > +++ b/drivers/i2c/busses/i2c-xiic.c
> > @@ -359,16 +359,28 @@ static inline void xiic_irq_clr_en(struct xiic_i2c *i2c, u32 mask)
> > xiic_irq_en(i2c, mask);
> > }
> >
> > +static int xiic_poll_rx_empty(struct xiic_i2c *i2c)
> > +{
> > + if (xiic_getreg8(i2c, XIIC_SR_REG_OFFSET) &
> > + XIIC_SR_RX_FIFO_EMPTY_MASK)
> > + return 1;
> > +
> > + xiic_getreg8(i2c, XIIC_DRR_REG_OFFSET);
> > + return 0;
> > +}
> > +
> > static int xiic_clear_rx_fifo(struct xiic_i2c *i2c)
> > {
> > - u8 sr;
> > + int rx_empty;
> > unsigned long timeout;
> >
> > + if (i2c->atomic)
> > + return read_poll_timeout_atomic(xiic_poll_rx_empty,
> > + rx_empty, rx_empty, 10, XIIC_I2C_TIMEOUT,
> > + 0, i2c);
> > +
> read_poll_timeout_atomic() expects its timeout argument in
> microseconds the current one is jiffies. Can you check it.
Ack
kind regards,
Thilo
More information about the linux-arm-kernel
mailing list