From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSl-0003Pp-Oy for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4iSe-0006Gw-Ay for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:17:59 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60971 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSe-0006Gn-52 for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:17:52 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 1 Aug 2013 04:17:26 +0200 Message-Id: <1375323463-32747-6-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 05/22] virtio: Allow NULL VirtioDeviceClass::init hook 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?= This is a temporary measure to allow mixing VirtioDeviceClass::init with DeviceClass::realize. Clean up variable naming in preparation for QOM realize. Signed-off-by: Andreas F=C3=A4rber --- hw/virtio/virtio.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 09f62c6..c00c224 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1139,13 +1139,15 @@ void virtio_device_set_child_bus_name(VirtIODevic= e *vdev, char *bus_name) } } =20 -static int virtio_device_init(DeviceState *qdev) +static int virtio_device_init(DeviceState *dev) { - VirtIODevice *vdev =3D VIRTIO_DEVICE(qdev); - VirtioDeviceClass *k =3D VIRTIO_DEVICE_GET_CLASS(qdev); - assert(k->init !=3D NULL); - if (k->init(vdev) < 0) { - return -1; + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_GET_CLASS(dev); + + if (vdc->init !=3D NULL) { + if (vdc->init(vdev) < 0) { + return -1; + } } virtio_bus_plug_device(vdev); return 0; --=20 1.8.1.4