From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4ryb-0002qy-4v for qemu-devel@nongnu.org; Thu, 10 Nov 2016 11:13:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4rya-0008Bc-9v for qemu-devel@nongnu.org; Thu, 10 Nov 2016 11:13:21 -0500 Received: from mail.kernel.org ([198.145.29.136]:45372) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c4rya-0008At-4H for qemu-devel@nongnu.org; Thu, 10 Nov 2016 11:13:20 -0500 Date: Thu, 10 Nov 2016 18:13:16 +0200 From: "Michael S. Tsirkin" Message-ID: <1478794177-29377-19-git-send-email-mst@redhat.com> References: <1478794177-29377-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478794177-29377-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 18/47] vhost: Use vbus var instead of VIRTIO_BUS() macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Felipe Franciosi From: Felipe Franciosi 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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); } -- MST