|
|
9ae3a8 |
From 8c40efb1aad9861f12b958002c5cfae1d91aeae5 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 23 Jan 2014 14:03:39 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 12/14] virtio-rng: switch exit callback to VirtioDeviceClass
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1390485820-7585-10-git-send-email-armbru@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56928
|
|
|
9ae3a8 |
O-Subject: [PATCH 7.0 qemu-kvm 09/10] virtio-rng: switch exit callback to VirtioDeviceClass
|
|
|
9ae3a8 |
Bugzilla: 983344
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This ensures hot-unplug is handled properly by the proxy, and avoids
|
|
|
9ae3a8 |
leaking bus_name which is freed by virtio_device_exit.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: qemu-stable@nongnu.org
|
|
|
9ae3a8 |
Acked-by: Andreas Faerber <afaerber@suse.de>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 7bb6edb0e3dd78d74e0ac980cf6c0a07307f61bf)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
hw/virtio/virtio-rng.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Trivially conflicts because we lack commit bc72ad6 "aio / timers:
|
|
|
9ae3a8 |
Switch entire codebase to the new timer API".
|
|
|
9ae3a8 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/virtio/virtio-rng.c | 10 ++++------
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/virtio/virtio-rng.c | 10 ++++------
|
|
|
9ae3a8 |
1 files changed, 4 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
|
|
|
9ae3a8 |
index bac8421..6895146 100644
|
|
|
9ae3a8 |
--- a/hw/virtio/virtio-rng.c
|
|
|
9ae3a8 |
+++ b/hw/virtio/virtio-rng.c
|
|
|
9ae3a8 |
@@ -184,16 +184,14 @@ static int virtio_rng_device_init(VirtIODevice *vdev)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int virtio_rng_device_exit(DeviceState *qdev)
|
|
|
9ae3a8 |
+static void virtio_rng_device_exit(VirtIODevice *vdev)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- VirtIORNG *vrng = VIRTIO_RNG(qdev);
|
|
|
9ae3a8 |
- VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
|
|
|
9ae3a8 |
+ VirtIORNG *vrng = VIRTIO_RNG(vdev);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
qemu_del_timer(vrng->rate_limit_timer);
|
|
|
9ae3a8 |
qemu_free_timer(vrng->rate_limit_timer);
|
|
|
9ae3a8 |
- unregister_savevm(qdev, "virtio-rng", vrng);
|
|
|
9ae3a8 |
+ unregister_savevm(DEVICE(vdev), "virtio-rng", vrng);
|
|
|
9ae3a8 |
virtio_cleanup(vdev);
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static Property virtio_rng_properties[] = {
|
|
|
9ae3a8 |
@@ -205,10 +203,10 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
9ae3a8 |
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
|
|
9ae3a8 |
- dc->exit = virtio_rng_device_exit;
|
|
|
9ae3a8 |
dc->props = virtio_rng_properties;
|
|
|
9ae3a8 |
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
|
|
9ae3a8 |
vdc->init = virtio_rng_device_init;
|
|
|
9ae3a8 |
+ vdc->exit = virtio_rng_device_exit;
|
|
|
9ae3a8 |
vdc->get_features = get_features;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|