Re: [PATCH v2 1/3] i2c: spacemit: Avoid sleeping during bus reset in atomic context

From: Andi Shyti

Date: Mon Nov 30 2026 - 07:40:21 EST


Hi Anand,

On Wed, Nov 18, 2026 at 04:19:13PM +0530, Anand Moon wrote:
> The spacemit_i2c_conditionally_reset_bus() function uses usleep_range()
> to wait after triggering a bus reset request. However, this function can
> be invoked during atomic I2C transfers (such as power-off or restart
> handlers running in atomic notifier chains), where sleeping is illegal.
>
> Replace the sleep operation with the driver's internal helper,
> spacemit_i2c_delay(), which conditionally uses udelay() when running in
> an atomic context, avoiding "scheduling while atomic" bugs.
>
> Fixes: 5dd75dac1b35 ("i2c: spacemit: introduce pio for k1")
> Cc: Troy Mitchell <troy.mitchell@xxxxxxxxxxxxxxxxxx>
> Cc: Alex Elder <elder@xxxxxxxxxxxx>
> Reviewed-by: Alex Elder <elder@xxxxxxxxxxxx>
> Reviewed-by: Aurelien Jarno <aurelien@xxxxxxxxxxx>
> Reviewed-by: Troy Mitchell <troy.mitchell@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Anand Moon <linux.amoon@xxxxxxxxx>

I just took this patch 1 into i2c/i2c-fixes.

Thanks,
Andi