From 306ec6c3cece7004429c79c1ac93d49919f1f1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 30 Jul 2013 03:50:44 +0200 Subject: virtio: Convert exit to unrealize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Färber Signed-off-by: Paolo Bonzini --- hw/virtio/virtio-balloon.c | 9 +++++---- hw/virtio/virtio-rng.c | 9 +++++---- hw/virtio/virtio.c | 13 ++++++++----- 3 files changed, 18 insertions(+), 13 deletions(-) (limited to 'hw/virtio') diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 755e188fdb..d9754dbd33 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -370,13 +370,14 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp) NULL, s, NULL); } -static void virtio_balloon_device_exit(VirtIODevice *vdev) +static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp) { - VirtIOBalloon *s = VIRTIO_BALLOON(vdev); + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VirtIOBalloon *s = VIRTIO_BALLOON(dev); balloon_stats_destroy_timer(s); qemu_remove_balloon_handler(s); - unregister_savevm(DEVICE(vdev), "virtio-balloon", s); + unregister_savevm(dev, "virtio-balloon", s); virtio_cleanup(vdev); } @@ -392,7 +393,7 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data) dc->props = virtio_balloon_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); vdc->realize = virtio_balloon_device_realize; - vdc->exit = virtio_balloon_device_exit; + vdc->unrealize = virtio_balloon_device_unrealize; vdc->get_config = virtio_balloon_get_config; vdc->set_config = virtio_balloon_set_config; vdc->get_features = virtio_balloon_get_features; diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index fd61cb2edf..755fdee628 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -187,13 +187,14 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp) virtio_rng_load, vrng); } -static void virtio_rng_device_exit(VirtIODevice *vdev) +static void virtio_rng_device_unrealize(DeviceState *dev, Error **errp) { - VirtIORNG *vrng = VIRTIO_RNG(vdev); + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VirtIORNG *vrng = VIRTIO_RNG(dev); timer_del(vrng->rate_limit_timer); timer_free(vrng->rate_limit_timer); - unregister_savevm(DEVICE(vdev), "virtio-rng", vrng); + unregister_savevm(dev, "virtio-rng", vrng); virtio_cleanup(vdev); } @@ -210,7 +211,7 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data) dc->props = virtio_rng_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); vdc->realize = virtio_rng_device_realize; - vdc->exit = virtio_rng_device_exit; + vdc->unrealize = virtio_rng_device_unrealize; vdc->get_features = get_features; } diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 1dba284e4a..144b9ca2ef 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1169,12 +1169,15 @@ static void virtio_device_realize(DeviceState *dev, Error **errp) static void virtio_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(dev); - - virtio_bus_device_unplugged(vdev); + VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(dev); + Error *err = NULL; - if (k->exit != NULL) { - k->exit(vdev); + if (vdc->unrealize != NULL) { + vdc->unrealize(dev, &err); + if (err != NULL) { + error_propagate(errp, err); + return; + } } if (vdev->bus_name) { -- cgit v1.2.1