aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio-balloon.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-30 02:51:37 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2013-12-09 21:46:49 +0100
commit74def47c8c1453a48f9bd61633050cc681e67fba (patch)
tree0a8b451014a67c24ae65d7b47ef2eeccd1408848 /hw/virtio/virtio-balloon.c
parente6f746b380ad04246e5cce621f174355f39addcd (diff)
virtio-balloon: Convert to QOM realize
Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/virtio/virtio-balloon.c')
-rw-r--r--hw/virtio/virtio-balloon.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index e6f6b4b690..755e188fdb 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -337,9 +337,9 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
-static int virtio_balloon_device_init(VirtIODevice *vdev)
+static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
{
- DeviceState *dev = DEVICE(vdev);
+ VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOBalloon *s = VIRTIO_BALLOON(dev);
int ret;
@@ -349,8 +349,9 @@ static int virtio_balloon_device_init(VirtIODevice *vdev)
virtio_balloon_stat, s);
if (ret < 0) {
+ error_setg(errp, "Adding balloon handler failed");
virtio_cleanup(vdev);
- return -1;
+ return;
}
s->ivq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);
@@ -367,7 +368,6 @@ static int virtio_balloon_device_init(VirtIODevice *vdev)
balloon_stats_get_poll_interval,
balloon_stats_set_poll_interval,
NULL, s, NULL);
- return 0;
}
static void virtio_balloon_device_exit(VirtIODevice *vdev)
@@ -388,9 +388,10 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
+
dc->props = virtio_balloon_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
- vdc->init = virtio_balloon_device_init;
+ vdc->realize = virtio_balloon_device_realize;
vdc->exit = virtio_balloon_device_exit;
vdc->get_config = virtio_balloon_get_config;
vdc->set_config = virtio_balloon_set_config;