Skip to contentSkip to conversation

i2c: virtio: mark device ready before registering the adapter

PATCH Applied Alexis Bouzigues 2 participants 2 messages May 29 – May 30

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 f5866db64f34 ("virtio_console: enable VQs early") and commit 71e4b8bf0482 ("virtio_rpmsg: set DRIVER_OK before using device").

---
 drivers/i2c/busses/i2c-virtio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-virtio.c +2 -0
index 7b0b0bff8000..5da6fef92bec 100644
@@ -222,6 +222,8 @@ static int virtio_i2c_probe(struct virtio_device *vdev)
 	 */
 	ACPI_COMPANION_SET(&vi->adap.dev, ACPI_COMPANION(vdev->dev.parent));
 
+	virtio_device_ready(vdev);
+
 	ret = i2c_add_adapter(&vi->adap);
 	if (ret)
 		virtio_i2c_del_vqs(vdev);

---
base-commit: 7fd2df204f342fc17d1a0bfcd474b24232fb0f32
change-id: 20260529-virtio-i2c-driver-ok-96444c2e5398

Best regards,

Signature · 1 line
Alexis Bouzigues <[email protected]>
Applied
#1 lore raw
Quoted 7 lines · On Fri, May 29, 2026 at 09:28:14AM -0500, Alexis Bouzigues via B4 Relay wrote:

From: Alexis Bouzigues <[email protected]>

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.

Quoted 6 lines

Set DRIVER_OK explicitly before i2c_add_adapter(), as done for the same reason in commit f5866db64f34 ("virtio_console: enable VQs early") and commit 71e4b8bf0482 ("virtio_rpmsg: set DRIVER_OK before using device").

Applied to for-current, thanks!