Received: from eggs.gnu.org ([2001:4830:134:3::10]:47406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSy-0003aB-2y for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4iSm-0006OR-W6 for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:32776 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSm-0006Nz-Kz for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:00 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 1 Aug 2013 04:17:41 +0200 Message-Id: <1375323463-32747-21-git-send-email-afaerber@suse.de> In-Reply-To: <1375323463-32747-1-git-send-email-afaerber@suse.de> References: <1375323463-32747-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-next v2 20/22] virtio: Convert VirtioDevice to QOM realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , =?UTF-8?q?Andreas=20F=C3=A4rber?= Drop VirtioDevice::init. Signed-off-by: Andreas F=C3=A4rber --- hw/virtio/virtio.c | 18 +++++------------- include/hw/virtio/virtio.h | 6 ++++-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index c00c224..8f19095 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1139,37 +1139,29 @@ void virtio_device_set_child_bus_name(VirtIODevic= e *vdev, char *bus_name) } } =20 -static int virtio_device_init(DeviceState *dev) +static void virtio_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); - VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_GET_CLASS(dev); =20 - if (vdc->init !=3D NULL) { - if (vdc->init(vdev) < 0) { - return -1; - } - } virtio_bus_plug_device(vdev); - return 0; } =20 -static int virtio_device_exit(DeviceState *qdev) +static void virtio_device_unrealize(DeviceState *dev, Error **errp) { - VirtIODevice *vdev =3D VIRTIO_DEVICE(qdev); + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); =20 if (vdev->bus_name) { g_free(vdev->bus_name); vdev->bus_name =3D NULL; } - return 0; } =20 static void virtio_device_class_init(ObjectClass *klass, void *data) { /* Set the default value here. */ DeviceClass *dc =3D DEVICE_CLASS(klass); - dc->init =3D virtio_device_init; - dc->exit =3D virtio_device_exit; + dc->realize =3D virtio_device_realize; + dc->unrealize =3D virtio_device_unrealize; dc->bus_type =3D TYPE_VIRTIO_BUS; } =20 diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index d7e9e0f..89b1793 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -124,9 +124,11 @@ struct VirtIODevice }; =20 typedef struct VirtioDeviceClass { - /* This is what a VirtioDevice must implement */ + /*< private >*/ DeviceClass parent; - int (*init)(VirtIODevice *vdev); + /*< public >*/ + + /* This is what a VirtioDevice must implement */ uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_feat= ures); uint32_t (*bad_features)(VirtIODevice *vdev); void (*set_features)(VirtIODevice *vdev, uint32_t val); --=20 1.8.1.4