Skip to content

Commit 1d77458

Browse files
Alexis BouziguesWolfram Sang
authored andcommitted
i2c: virtio: mark device ready before registering the adapter
virtio_i2c_probe() synchronously probes child i2c drivers on the bus, but peripherals may use the bus at probe for tasks like reading a chip id. The vhost-user-i2c backend stalls at such probes unless DRIVER_OK is already set before the virtqueue is first kicked. Set DRIVER_OK explicitly before i2c_add_adapter(), as done for the same reason in commit f5866db ("virtio_console: enable VQs early") and commit 71e4b8b ("virtio_rpmsg: set DRIVER_OK before using device"). Signed-off-by: Alexis Bouzigues <BouziguesAlexis@JohnDeere.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
1 parent e2aecff commit 1d77458

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/i2c/busses/i2c-virtio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ static int virtio_i2c_probe(struct virtio_device *vdev)
222222
*/
223223
ACPI_COMPANION_SET(&vi->adap.dev, ACPI_COMPANION(vdev->dev.parent));
224224

225+
virtio_device_ready(vdev);
226+
225227
ret = i2c_add_adapter(&vi->adap);
226228
if (ret)
227229
virtio_i2c_del_vqs(vdev);

0 commit comments

Comments
 (0)