Re: [PATCH] i2c: core: Fix atomic xfer check for non-preempt config

From: Michael Walle
Date: Thu Jan 04 2024 - 04:19:14 EST


From: Benjamin Bara <benjamin.bara@xxxxxxxxxxx>

Since commit aa49c90894d0 ("i2c: core: Run atomic i2c xfer when
!preemptible"), the whole reboot/power off sequence on non-preempt kernels
is using atomic i2c xfer, as !preemptible() always results to 1.

During device_shutdown(), the i2c might be used a lot and not all busses
have implemented an atomic xfer handler. This results in a lot of
avoidable noise, like:

[ 12.687169] No atomic I2C transfer handler for 'i2c-0'
[ 12.692313] WARNING: CPU: 6 PID: 275 at drivers/i2c/i2c-core.h:40 i2c_smbus_xfer+0x100/0x118
...

Fix this by allowing non-atomic xfer when the interrupts are enabled, as
it was before.

Fixes: aa49c90894d0 ("i2c: core: Run atomic i2c xfer when !preemptible")
Cc: stable@xxxxxxxxxxxxxxx # v5.2+
Signed-off-by: Benjamin Bara <benjamin.bara@xxxxxxxxxxx>

Tested-by: Michael Walle <mwalle@xxxxxxxxxx>

Thanks for the fix, if there will be a -rc9 this should definitely go in.

-michael