提交 baa61b98 编写于 作者: P Paolo Bonzini

virtio-balloon: switch exit callback to VirtioDeviceClass

This ensures hot-unplug is handled properly by the proxy, and avoids
leaking bus_name which is freed by virtio_device_exit.

Cc: qemu-stable@nongnu.org
Acked-by: NAndreas Faerber <afaerber@suse.de>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 e3c9d76a
...@@ -370,16 +370,14 @@ static int virtio_balloon_device_init(VirtIODevice *vdev) ...@@ -370,16 +370,14 @@ static int virtio_balloon_device_init(VirtIODevice *vdev)
return 0; return 0;
} }
static int virtio_balloon_device_exit(DeviceState *qdev) static void virtio_balloon_device_exit(VirtIODevice *vdev)
{ {
VirtIOBalloon *s = VIRTIO_BALLOON(qdev); VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
balloon_stats_destroy_timer(s); balloon_stats_destroy_timer(s);
qemu_remove_balloon_handler(s); qemu_remove_balloon_handler(s);
unregister_savevm(qdev, "virtio-balloon", s); unregister_savevm(DEVICE(vdev), "virtio-balloon", s);
virtio_cleanup(vdev); virtio_cleanup(vdev);
return 0;
} }
static Property virtio_balloon_properties[] = { static Property virtio_balloon_properties[] = {
...@@ -390,10 +388,10 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data) ...@@ -390,10 +388,10 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
dc->exit = virtio_balloon_device_exit;
dc->props = virtio_balloon_properties; dc->props = virtio_balloon_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories); set_bit(DEVICE_CATEGORY_MISC, dc->categories);
vdc->init = virtio_balloon_device_init; vdc->init = virtio_balloon_device_init;
vdc->exit = virtio_balloon_device_exit;
vdc->get_config = virtio_balloon_get_config; vdc->get_config = virtio_balloon_get_config;
vdc->set_config = virtio_balloon_set_config; vdc->set_config = virtio_balloon_set_config;
vdc->get_features = virtio_balloon_get_features; vdc->get_features = virtio_balloon_get_features;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册