public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>,
	virtualization@lists.linux-foundation.org,
	Anthony Liguori <anthony@codemonkey.ws>,
	kvm@vger.kernel.org, avi@redhat.com
Subject: [PATCH 3/8] virtio-rng: add request_vqs/free_vqs calls
Date: Mon, 27 Apr 2009 15:32:26 +0300	[thread overview]
Message-ID: <20090427123226.GA1175@redhat.com> (raw)
In-Reply-To: <cover.1240832196.git.mst@redhat.com>

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 --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


  parent reply	other threads:[~2009-04-27 12:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1240832196.git.mst@redhat.com>
2009-04-27 12:31 ` [PATCH 1/8] virtio: add request_vqs/free_vqs operations Michael S. Tsirkin
2009-05-04 11:32   ` Rusty Russell
2009-05-04 11:51     ` Michael S. Tsirkin
2009-04-27 12:32 ` [PATCH 2/8] virtio_blk: add request_vqs/free_vqs calls Michael S. Tsirkin
2009-04-27 12:32 ` Michael S. Tsirkin [this message]
2009-04-27 12:32 ` [PATCH 4/8] virtio_console: " Michael S. Tsirkin
2009-04-27 12:32 ` [PATCH 5/8] virtio_net: " Michael S. Tsirkin
2009-04-27 12:33 ` [PATCH 6/8] virtio_balloon: " Michael S. Tsirkin
2009-04-27 12:33 ` [PATCH 7/8] virtio_pci: split up vp_interrupt Michael S. Tsirkin
2009-04-27 12:33 ` [PATCH 8/8] virtio_pci: optional MSI-X support Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090427123226.GA1175@redhat.com \
    --to=mst@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox