diff mbox

[3/8] virtio-rng: add request_vqs/free_vqs calls

Message ID 20090427123226.GA1175@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael S. Tsirkin April 27, 2009, 12:32 p.m. UTC
Add request_vqs/free_vqs calls to virtio-rng.
These will be required for MSI support.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/char/hw_random/virtio-rng.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index d0e563e..d43a6cd 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -94,13 +94,20 @@  static int virtrng_probe(struct virtio_device *vdev)
 	int err;
 
 	/* We expect a single virtqueue. */
+	err = virtio_request_vqs(vdev, 1);
+	if (err)
+		return err;
+
 	vq = vdev->config->find_vq(vdev, 0, random_recv_done);
-	if (IS_ERR(vq))
+	if (IS_ERR(vq)) {
+		virtio_free_vqs(vdev);
 		return PTR_ERR(vq);
+	}
 
 	err = hwrng_register(&virtio_hwrng);
 	if (err) {
 		vdev->config->del_vq(vq);
+		virtio_free_vqs(vdev);
 		return err;
 	}
 
@@ -113,6 +120,7 @@  static void virtrng_remove(struct virtio_device *vdev)
 	vdev->config->reset(vdev);
 	hwrng_unregister(&virtio_hwrng);
 	vdev->config->del_vq(vq);
+	virtio_free_vqs(vdev);
 }
 
 static struct virtio_device_id id_table[] = {