From 1c819449836b926d6f9db860127211ef092da88e Mon Sep 17 00:00:00 2001 From: KONRAD Frederic Date: Wed, 24 Apr 2013 10:21:21 +0200 Subject: virtio: remove virtiobindings. This remove virtio-bindings, and use class instead. Signed-off-by: KONRAD Frederic Message-id: 1366791683-5350-6-git-send-email-fred.konrad@greensocs.com Signed-off-by: Anthony Liguori --- hw/block/dataplane/virtio-blk.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'hw/block/dataplane') diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 5baef2391a..03566650c6 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -23,6 +23,7 @@ #include "hw/virtio/virtio-blk.h" #include "virtio-blk.h" #include "block/aio.h" +#include "hw/virtio/virtio-bus.h" enum { SEG_MAX = 126, /* maximum number of I/O segments */ @@ -455,6 +456,8 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s) void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) { + BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtQueue *vq; int i; @@ -470,8 +473,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) s->ctx = aio_context_new(); /* Set up guest notifier (irq) */ - if (s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque, 1, - true) != 0) { + if (k->set_guest_notifiers(qbus->parent, 1, true) != 0) { fprintf(stderr, "virtio-blk failed to set guest notifier, " "ensure -enable-kvm is set\n"); exit(1); @@ -479,8 +481,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) s->guest_notifier = virtio_queue_get_guest_notifier(vq); /* Set up virtqueue notify */ - if (s->vdev->binding->set_host_notifier(s->vdev->binding_opaque, - 0, true) != 0) { + if (k->set_host_notifier(qbus->parent, 0, true) != 0) { fprintf(stderr, "virtio-blk failed to set host notifier\n"); exit(1); } @@ -508,6 +509,8 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) { + BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); if (!s->started || s->stopping) { return; } @@ -527,12 +530,12 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) ioq_cleanup(&s->ioqueue); aio_set_event_notifier(s->ctx, &s->host_notifier, NULL, NULL); - s->vdev->binding->set_host_notifier(s->vdev->binding_opaque, 0, false); + k->set_host_notifier(qbus->parent, 0, false); aio_context_unref(s->ctx); /* Clean up guest notifier (irq) */ - s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque, 1, false); + k->set_guest_notifiers(qbus->parent, 1, false); vring_teardown(&s->vring); s->started = false; -- cgit v1.2.1