peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0010-virtio-net-switch-exit-callback-to-VirtioDeviceClass.patch

45bdef
From 8ed30b7ae128c31617c96128d9aa126332c7afaa Mon Sep 17 00:00:00 2001
298366
From: Paolo Bonzini <pbonzini@redhat.com>
298366
Date: Fri, 20 Sep 2013 16:57:56 +0200
298366
Subject: [PATCH] virtio-net: switch exit callback to VirtioDeviceClass
298366
298366
This ensures hot-unplug is handled properly by the proxy.
298366
298366
Cc: qemu-stable@nongnu.org
298366
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
298366
---
298366
 hw/net/virtio-net.c | 11 ++++-------
298366
 1 file changed, 4 insertions(+), 7 deletions(-)
298366
298366
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
45bdef
index b75c753..93a81eb 100644
298366
--- a/hw/net/virtio-net.c
298366
+++ b/hw/net/virtio-net.c
45bdef
@@ -1570,16 +1570,15 @@ static int virtio_net_device_init(VirtIODevice *vdev)
298366
     return 0;
298366
 }
298366
 
298366
-static int virtio_net_device_exit(DeviceState *qdev)
298366
+static void virtio_net_device_exit(VirtIODevice *vdev)
298366
 {
298366
-    VirtIONet *n = VIRTIO_NET(qdev);
298366
-    VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
298366
+    VirtIONet *n = VIRTIO_NET(vdev);
298366
     int i;
298366
 
298366
     /* This will stop vhost backend if appropriate. */
298366
     virtio_net_set_status(vdev, 0);
298366
 
298366
-    unregister_savevm(qdev, "virtio-net", n);
298366
+    unregister_savevm(DEVICE(vdev), "virtio-net", n);
298366
 
298366
     if (n->netclient_name) {
298366
         g_free(n->netclient_name);
45bdef
@@ -1610,8 +1609,6 @@ static int virtio_net_device_exit(DeviceState *qdev)
298366
     g_free(n->vqs);
298366
     qemu_del_nic(n->nic);
298366
     virtio_cleanup(vdev);
298366
-
298366
-    return 0;
298366
 }
298366
 
298366
 static void virtio_net_instance_init(Object *obj)
45bdef
@@ -1638,10 +1635,10 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
298366
 {
298366
     DeviceClass *dc = DEVICE_CLASS(klass);
298366
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
298366
-    dc->exit = virtio_net_device_exit;
298366
     dc->props = virtio_net_properties;
298366
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
298366
     vdc->init = virtio_net_device_init;
298366
+    vdc->exit = virtio_net_device_exit;
298366
     vdc->get_config = virtio_net_get_config;
298366
     vdc->set_config = virtio_net_set_config;
298366
     vdc->get_features = virtio_net_get_features;