Michael S. Tsirkin
2009-Apr-27 12:32 UTC
[PATCH 3/8] virtio-rng: add request_vqs/free_vqs calls
Add request_vqs/free_vqs calls to virtio-rng. These will be required for MSI support. Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- drivers/char/hw_random/virtio-rng.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) 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[] = { -- 1.6.0.6