yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-virtio-rng-switch-exit-callback-to-VirtioDeviceClass.patch

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