2021-11-27 19:44:18

by Aaro Koskinen

[permalink] [raw]
Subject: [PATCH] i2c: cbus-gpio: set atomic transfer callback

CBUS transfers have always been atomic, but after commit 63b96983a5dd
("i2c: core: introduce callbacks for atomic transfers") we started to see
warnings during e.g. poweroff as the atomic callback is not explicitly set.
Fix that.

Fixes the following WARNING seen during Nokia N810 power down:

[ 786.570617] reboot: Power down
[ 786.573913] ------------[ cut here ]------------
[ 786.578826] WARNING: CPU: 0 PID: 672 at drivers/i2c/i2c-core.h:40 i2c_smbus_xfer+0x100/0x110
[ 786.587799] No atomic I2C transfer handler for 'i2c-2'

Fixes: 63b96983a5dd ("i2c: core: introduce callbacks for atomic transfers")
Signed-off-by: Aaro Koskinen <[email protected]>
---
drivers/i2c/busses/i2c-cbus-gpio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cbus-gpio.c b/drivers/i2c/busses/i2c-cbus-gpio.c
index 72df563477b1..f8639a4457d2 100644
--- a/drivers/i2c/busses/i2c-cbus-gpio.c
+++ b/drivers/i2c/busses/i2c-cbus-gpio.c
@@ -195,8 +195,9 @@ static u32 cbus_i2c_func(struct i2c_adapter *adapter)
}

static const struct i2c_algorithm cbus_i2c_algo = {
- .smbus_xfer = cbus_i2c_smbus_xfer,
- .functionality = cbus_i2c_func,
+ .smbus_xfer = cbus_i2c_smbus_xfer,
+ .smbus_xfer_atomic = cbus_i2c_smbus_xfer,
+ .functionality = cbus_i2c_func,
};

static int cbus_i2c_remove(struct platform_device *pdev)
--
2.17.0



2021-11-29 08:54:41

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c: cbus-gpio: set atomic transfer callback

On Sat, Nov 27, 2021 at 09:42:14PM +0200, Aaro Koskinen wrote:
> CBUS transfers have always been atomic, but after commit 63b96983a5dd
> ("i2c: core: introduce callbacks for atomic transfers") we started to see
> warnings during e.g. poweroff as the atomic callback is not explicitly set.
> Fix that.
>
> Fixes the following WARNING seen during Nokia N810 power down:
>
> [ 786.570617] reboot: Power down

Applied to for-current, thanks!


Attachments:
(No filename) (442.00 B)
signature.asc (833.00 B)
Download all attachments