Skip to contentSkip to conversation

virtio: don't set VIRTIO_CONFIG_S_DRIVER_OK twice.

PATCH New Rusty Russell 1 participant 1 message Feb 13, 2015 virtio core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio: don't set VIRTIO_CONFIG_S_DRIVER_OK twice.

I noticed this with the console device. It's not *wrong*, just a bit weird.

drivers/virtio/virtio.c +4 -1
index b9f70dfc4751..5ce2aa48fc6e 100644
@@ -236,7 +236,10 @@ static int virtio_dev_probe(struct device *_d)
 	if (err)
 		goto err;
 
-	add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
+	/* If probe didn't do it, mark device DRIVER_OK ourselves. */
+	if (!(dev->config->get_status(dev) & VIRTIO_CONFIG_S_DRIVER_OK))
+		virtio_device_ready(dev);
+
 	if (drv->scan)
 		drv->scan(dev);