From patchwork Wed Nov 9 13:18:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 9419191 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6372E601C0 for ; Wed, 9 Nov 2016 13:18:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55B042928C for ; Wed, 9 Nov 2016 13:18:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48C9D29291; Wed, 9 Nov 2016 13:18:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92A9F2928F for ; Wed, 9 Nov 2016 13:18:45 +0000 (UTC) Received: from localhost ([::1]:39871 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4Sm4-0001g0-8S for patchwork-qemu-devel@patchwork.kernel.org; Wed, 09 Nov 2016 08:18:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4Sll-0001fW-JI for qemu-devel@nongnu.org; Wed, 09 Nov 2016 08:18:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4Sli-00019s-9J for qemu-devel@nongnu.org; Wed, 09 Nov 2016 08:18:25 -0500 Received: from 206-15-90-246.static.twtelecom.net ([206.15.90.246]:35826 helo=felipe-franciosi.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4Sli-00019A-3p for qemu-devel@nongnu.org; Wed, 09 Nov 2016 08:18:22 -0500 Received: by felipe-franciosi.localdomain (Postfix, from userid 500) id BBE571001A9; Wed, 9 Nov 2016 05:18:20 -0800 (PST) From: Felipe Franciosi To: Paolo Bonzini , Stefan Hajnoczi , "Michael S. Tsirkin" Date: Wed, 9 Nov 2016 05:18:18 -0800 Message-Id: <1478697498-29833-1-git-send-email-felipe@nutanix.com> X-Mailer: git-send-email 1.9.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 206.15.90.246 Subject: [Qemu-devel] [PATCH] vhost: Use vbus var instead of VIRTIO_BUS() macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" , Felipe Franciosi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Recent changes on vhost_dev_enable/disable_notifiers() produced a VirtioBusState vbus variable which can be used instead of the VIRTIO_BUS() macro. This commit just makes the code a little bit cleaner and more consistent. Signed-off-by: Felipe Franciosi --- hw/virtio/vhost.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 1290963..7d29dad 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1198,20 +1198,18 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) virtio_device_stop_ioeventfd(vdev); for (i = 0; i < hdev->nvqs; ++i) { - r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i, - true); + r = virtio_bus_set_host_notifier(vbus, hdev->vq_index + i, true); if (r < 0) { error_report("vhost VQ %d notifier binding failed: %d", i, -r); goto fail_vq; } } - VIRTIO_BUS(qbus)->ioeventfd_started = true; + vbus->ioeventfd_started = true; return 0; fail_vq: while (--i >= 0) { - e = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i, - false); + e = virtio_bus_set_host_notifier(vbus, hdev->vq_index + i, false); if (e < 0) { error_report("vhost VQ %d notifier cleanup error: %d", i, -r); } @@ -1230,17 +1228,17 @@ fail: void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusState *vbus = VIRTIO_BUS(qbus); int i, r; for (i = 0; i < hdev->nvqs; ++i) { - r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i, - false); + r = virtio_bus_set_host_notifier(vbus, hdev->vq_index + i, false); if (r < 0) { error_report("vhost VQ %d notifier cleanup failed: %d", i, -r); } assert (r >= 0); } - VIRTIO_BUS(qbus)->ioeventfd_started = false; + vbus->ioeventfd_started = false; virtio_device_start_ioeventfd(vdev); }