From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq7mA-0006st-Cm for qemu-devel@nongnu.org; Mon, 09 Dec 2013 15:50:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vq7m4-0003vb-O2 for qemu-devel@nongnu.org; Mon, 09 Dec 2013 15:49:58 -0500 Received: from mail-ee0-x22e.google.com ([2a00:1450:4013:c00::22e]:59622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq7m4-0003vQ-7e for qemu-devel@nongnu.org; Mon, 09 Dec 2013 15:49:52 -0500 Received: by mail-ee0-f46.google.com with SMTP id d49so1778922eek.5 for ; Mon, 09 Dec 2013 12:49:51 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 9 Dec 2013 21:48:28 +0100 Message-Id: <1386622112-27257-27-git-send-email-pbonzini@redhat.com> In-Reply-To: <1386622112-27257-1-git-send-email-pbonzini@redhat.com> References: <1386622112-27257-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 26/30] virtio-balloon: Convert to QOM realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, afaerber@suse.de, mst@redhat.com From: Andreas Färber Signed-off-by: Andreas Färber Signed-off-by: Paolo Bonzini --- hw/virtio/virtio-balloon.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index e6f6b4b..755e188 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; -- 1.8.4.2