yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From fed60f16a54ee6689b6c03025bbe4704a8e4b251 Mon Sep 17 00:00:00 2001
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
Date: Thu, 23 Jan 2014 14:03:36 +0100
0a122b
Subject: [PATCH 09/14] virtio-net: switch exit callback to VirtioDeviceClass
0a122b
0a122b
RH-Author: Markus Armbruster <armbru@redhat.com>
0a122b
Message-id: <1390485820-7585-7-git-send-email-armbru@redhat.com>
0a122b
Patchwork-id: 56926
0a122b
O-Subject: [PATCH 7.0 qemu-kvm 06/10] virtio-net: 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 3786cff5eb384d058395a2729af627fa3253d056)
0a122b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
0a122b
---
0a122b
 hw/net/virtio-net.c | 11 ++++-------
0a122b
 1 file changed, 4 insertions(+), 7 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/net/virtio-net.c |   11 ++++-------
0a122b
 1 files changed, 4 insertions(+), 7 deletions(-)
0a122b
0a122b
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
0a122b
index 21b126f..06c53fe 100644
0a122b
--- a/hw/net/virtio-net.c
0a122b
+++ b/hw/net/virtio-net.c
0a122b
@@ -1506,16 +1506,15 @@ static int virtio_net_device_init(VirtIODevice *vdev)
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
-static int virtio_net_device_exit(DeviceState *qdev)
0a122b
+static void virtio_net_device_exit(VirtIODevice *vdev)
0a122b
 {
0a122b
-    VirtIONet *n = VIRTIO_NET(qdev);
0a122b
-    VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
0a122b
+    VirtIONet *n = VIRTIO_NET(vdev);
0a122b
     int i;
0a122b
 
0a122b
     /* This will stop vhost backend if appropriate. */
0a122b
     virtio_net_set_status(vdev, 0);
0a122b
 
0a122b
-    unregister_savevm(qdev, "virtio-net", n);
0a122b
+    unregister_savevm(DEVICE(vdev), "virtio-net", n);
0a122b
 
0a122b
     if (n->netclient_name) {
0a122b
         g_free(n->netclient_name);
0a122b
@@ -1546,8 +1545,6 @@ static int virtio_net_device_exit(DeviceState *qdev)
0a122b
     g_free(n->vqs);
0a122b
     qemu_del_nic(n->nic);
0a122b
     virtio_cleanup(vdev);
0a122b
-
0a122b
-    return 0;
0a122b
 }
0a122b
 
0a122b
 static void virtio_net_instance_init(Object *obj)
0a122b
@@ -1574,10 +1571,10 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
0a122b
 {
0a122b
     DeviceClass *dc = DEVICE_CLASS(klass);
0a122b
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
0a122b
-    dc->exit = virtio_net_device_exit;
0a122b
     dc->props = virtio_net_properties;
0a122b
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
0a122b
     vdc->init = virtio_net_device_init;
0a122b
+    vdc->exit = virtio_net_device_exit;
0a122b
     vdc->get_config = virtio_net_get_config;
0a122b
     vdc->set_config = virtio_net_set_config;
0a122b
     vdc->get_features = virtio_net_get_features;
0a122b
-- 
0a122b
1.7.1
0a122b