From: Felipe Franciosi <felipe@nutanix.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Felipe Franciosi <felipe@nutanix.com>
Subject: [Qemu-devel] [PATCH] vhost: Use vbus var instead of VIRTIO_BUS() macro
Date: Wed, 9 Nov 2016 05:18:18 -0800 [thread overview]
Message-ID: <1478697498-29833-1-git-send-email-felipe@nutanix.com> (raw)
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 <felipe@nutanix.com>
---
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);
}
--
1.9.4
next reply other threads:[~2016-11-09 13:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 13:18 Felipe Franciosi [this message]
2016-11-09 13:22 ` [Qemu-devel] [PATCH] vhost: Use vbus var instead of VIRTIO_BUS() macro Paolo Bonzini
2016-11-09 13:24 ` Felipe Franciosi
2016-11-09 15:47 ` Michael S. Tsirkin
2016-11-09 15:54 ` Paolo Bonzini
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=1478697498-29833-1-git-send-email-felipe@nutanix.com \
--to=felipe@nutanix.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).