Blame SOURCES/kvm-virtio-serial-switch-exit-callback-to-VirtioDeviceCl.patch

0a122b
From faea056361cd9955f41a8d8c907af32625885b0d Mon Sep 17 00:00:00 2001
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
Date: Thu, 23 Jan 2014 14:03:35 +0100
0a122b
Subject: [PATCH 08/14] virtio-serial: switch exit callback to VirtioDeviceClass
0a122b
0a122b
RH-Author: Markus Armbruster <armbru@redhat.com>
0a122b
Message-id: <1390485820-7585-6-git-send-email-armbru@redhat.com>
0a122b
Patchwork-id: 56932
0a122b
O-Subject: [PATCH 7.0 qemu-kvm 05/10] virtio-serial: 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 0e86c13fe2058adb8c792ebb7c51a6a7ca9d3d55)
0a122b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
0a122b
---
0a122b
 hw/char/virtio-serial-bus.c | 10 ++++------
0a122b
 1 file changed, 4 insertions(+), 6 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/char/virtio-serial-bus.c |   10 ++++------
0a122b
 1 files changed, 4 insertions(+), 6 deletions(-)
0a122b
0a122b
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
0a122b
index da417c7..57dd070 100644
0a122b
--- a/hw/char/virtio-serial-bus.c
0a122b
+++ b/hw/char/virtio-serial-bus.c
0a122b
@@ -987,12 +987,11 @@ static const TypeInfo virtio_serial_port_type_info = {
0a122b
     .class_init = virtio_serial_port_class_init,
0a122b
 };
0a122b
 
0a122b
-static int virtio_serial_device_exit(DeviceState *dev)
0a122b
+static void virtio_serial_device_exit(VirtIODevice *vdev)
0a122b
 {
0a122b
-    VirtIOSerial *vser = VIRTIO_SERIAL(dev);
0a122b
-    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
0a122b
+    VirtIOSerial *vser = VIRTIO_SERIAL(vdev);
0a122b
 
0a122b
-    unregister_savevm(dev, "virtio-console", vser);
0a122b
+    unregister_savevm(DEVICE(vdev), "virtio-console", vser);
0a122b
 
0a122b
     g_free(vser->ivqs);
0a122b
     g_free(vser->ovqs);
0a122b
@@ -1004,7 +1003,6 @@ static int virtio_serial_device_exit(DeviceState *dev)
0a122b
         g_free(vser->post_load);
0a122b
     }
0a122b
     virtio_cleanup(vdev);
0a122b
-    return 0;
0a122b
 }
0a122b
 
0a122b
 static Property virtio_serial_properties[] = {
0a122b
@@ -1016,10 +1014,10 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data)
0a122b
 {
0a122b
     DeviceClass *dc = DEVICE_CLASS(klass);
0a122b
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
0a122b
-    dc->exit = virtio_serial_device_exit;
0a122b
     dc->props = virtio_serial_properties;
0a122b
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
0a122b
     vdc->init = virtio_serial_device_init;
0a122b
+    vdc->exit = virtio_serial_device_exit;
0a122b
     vdc->get_features = get_features;
0a122b
     vdc->get_config = get_config;
0a122b
     vdc->set_config = set_config;
0a122b
-- 
0a122b
1.7.1
0a122b