peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0013-virtio-rng-switch-exit-callback-to-VirtioDeviceClass.patch

bacd9b
From 8b9a562e23dbfdfb23a5eeb1b619619290216ad8 Mon Sep 17 00:00:00 2001
298366
From: Paolo Bonzini <pbonzini@redhat.com>
298366
Date: Fri, 20 Sep 2013 16:57:59 +0200
298366
Subject: [PATCH] virtio-rng: 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/virtio/virtio-rng.c | 10 ++++------
298366
 1 file changed, 4 insertions(+), 6 deletions(-)
298366
298366
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
45bdef
index b22ccf1..42ca568 100644
298366
--- a/hw/virtio/virtio-rng.c
298366
+++ b/hw/virtio/virtio-rng.c
45bdef
@@ -190,16 +190,14 @@ static int virtio_rng_device_init(VirtIODevice *vdev)
298366
     return 0;
298366
 }
298366
 
298366
-static int virtio_rng_device_exit(DeviceState *qdev)
298366
+static void virtio_rng_device_exit(VirtIODevice *vdev)
298366
 {
298366
-    VirtIORNG *vrng = VIRTIO_RNG(qdev);
298366
-    VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
298366
+    VirtIORNG *vrng = VIRTIO_RNG(vdev);
298366
 
45bdef
     timer_del(vrng->rate_limit_timer);
45bdef
     timer_free(vrng->rate_limit_timer);
298366
-    unregister_savevm(qdev, "virtio-rng", vrng);
298366
+    unregister_savevm(DEVICE(vdev), "virtio-rng", vrng);
298366
     virtio_cleanup(vdev);
298366
-    return 0;
298366
 }
298366
 
298366
 static Property virtio_rng_properties[] = {
45bdef
@@ -211,10 +209,10 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data)
298366
 {
298366
     DeviceClass *dc = DEVICE_CLASS(klass);
298366
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
298366
-    dc->exit = virtio_rng_device_exit;
298366
     dc->props = virtio_rng_properties;
298366
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
298366
     vdc->init = virtio_rng_device_init;
298366
+    vdc->exit = virtio_rng_device_exit;
298366
     vdc->get_features = get_features;
298366
 }
298366