From patchwork Mon Apr 27 12:32:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 20143 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3RCYPC5011272 for ; Mon, 27 Apr 2009 12:34:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754410AbZD0MeX (ORCPT ); Mon, 27 Apr 2009 08:34:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753568AbZD0MeX (ORCPT ); Mon, 27 Apr 2009 08:34:23 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53955 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753735AbZD0MeW (ORCPT ); Mon, 27 Apr 2009 08:34:22 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3RCXSLd016845; Mon, 27 Apr 2009 08:33:28 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3RCXRhT018198; Mon, 27 Apr 2009 08:33:27 -0400 Received: from redhat.com (vpn-10-134.str.redhat.com [10.32.10.134]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3RCXOBW008441; Mon, 27 Apr 2009 08:33:25 -0400 Date: Mon, 27 Apr 2009 15:32:26 +0300 From: "Michael S. Tsirkin" To: Rusty Russell , virtualization@lists.linux-foundation.org, Anthony Liguori , kvm@vger.kernel.org, avi@redhat.com Subject: [PATCH 3/8] virtio-rng: add request_vqs/free_vqs calls Message-ID: <20090427123226.GA1175@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add request_vqs/free_vqs calls to virtio-rng. These will be required for MSI support. Signed-off-by: Michael S. Tsirkin --- 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[] = {