Re: [PATCH v3 2/2] i2c: i2c-xiic: fix waiting/clearing while atomic
From: Shubhrajyoti Datta
Date: Fri Oct 30 2026 - 10:50:23 EST
On Fri, Oct 16, 2026 at 6:24 PM Thilo Zirnstein <thi.zirnstein@xxxxxxxxx> wrote:
>
> Use non jiffies based waiting functions,
> if in atomic context.
>
> Suggested-by: Andi Shyti <andi.shyti@xxxxxxxxxx>
> Signed-off-by: Thilo Zirnstein <thi.zirnstein@xxxxxxxxx>
> ---
> 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.