thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-virtio-balloon-switch-exit-callback-to-VirtioDeviceC.patch

0a122b
From 9813363c031fd56a536dfafd64dcc9bc430f9bb1 Mon Sep 17 00:00:00 2001
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
Date: Thu, 23 Jan 2014 14:03:38 +0100
0a122b
Subject: [PATCH 11/14] virtio-balloon: switch exit callback to VirtioDeviceClass
0a122b
0a122b
RH-Author: Markus Armbruster <armbru@redhat.com>
0a122b
Message-id: <1390485820-7585-9-git-send-email-armbru@redhat.com>
0a122b
Patchwork-id: 56930
0a122b
O-Subject: [PATCH 7.0 qemu-kvm 08/10] virtio-balloon: 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 baa61b9870dd7e0bb07e0ae61c6ec805db13f699)
0a122b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
0a122b
---
0a122b
 hw/virtio/virtio-balloon.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-balloon.c |   10 ++++------
0a122b
 1 files changed, 4 insertions(+), 6 deletions(-)
0a122b
0a122b
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
0a122b
index 85661f6..76c607f 100644
0a122b
--- a/hw/virtio/virtio-balloon.c
0a122b
+++ b/hw/virtio/virtio-balloon.c
0a122b
@@ -369,16 +369,14 @@ static int virtio_balloon_device_init(VirtIODevice *vdev)
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
-static int virtio_balloon_device_exit(DeviceState *qdev)
0a122b
+static void virtio_balloon_device_exit(VirtIODevice *vdev)
0a122b
 {
0a122b
-    VirtIOBalloon *s = VIRTIO_BALLOON(qdev);
0a122b
-    VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
0a122b
+    VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
0a122b
 
0a122b
     balloon_stats_destroy_timer(s);
0a122b
     qemu_remove_balloon_handler(s);
0a122b
-    unregister_savevm(qdev, "virtio-balloon", s);
0a122b
+    unregister_savevm(DEVICE(vdev), "virtio-balloon", s);
0a122b
     virtio_cleanup(vdev);
0a122b
-    return 0;
0a122b
 }
0a122b
 
0a122b
 static Property virtio_balloon_properties[] = {
0a122b
@@ -389,10 +387,10 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data)
0a122b
 {
0a122b
     DeviceClass *dc = DEVICE_CLASS(klass);
0a122b
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
0a122b
-    dc->exit = virtio_balloon_device_exit;
0a122b
     dc->props = virtio_balloon_properties;
0a122b
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
0a122b
     vdc->init = virtio_balloon_device_init;
0a122b
+    vdc->exit = virtio_balloon_device_exit;
0a122b
     vdc->get_config = virtio_balloon_get_config;
0a122b
     vdc->set_config = virtio_balloon_set_config;
0a122b
     vdc->get_features = virtio_balloon_get_features;
0a122b
-- 
0a122b
1.7.1
0a122b