From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq7mG-00075N-E1 for qemu-devel@nongnu.org; Mon, 09 Dec 2013 15:50:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vq7mA-0003xf-Sl for qemu-devel@nongnu.org; Mon, 09 Dec 2013 15:50:04 -0500 Received: from mail-ee0-x22a.google.com ([2a00:1450:4013:c00::22a]:44634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq7mA-0003xV-Mf for qemu-devel@nongnu.org; Mon, 09 Dec 2013 15:49:58 -0500 Received: by mail-ee0-f42.google.com with SMTP id e53so1800676eek.15 for ; Mon, 09 Dec 2013 12:49:57 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 9 Dec 2013 21:48:31 +0100 Message-Id: <1386622112-27257-30-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 29/30] virtio: Complete converting VirtioDevice 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 Drop VirtioDeviceClass::init. Signed-off-by: Andreas Färber Signed-off-by: Paolo Bonzini --- hw/scsi/virtio-scsi.c | 3 +-- hw/virtio/virtio.c | 6 ------ include/hw/virtio/virtio.h | 5 +++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 0a41ddb..a208cf3 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -642,8 +642,7 @@ static void virtio_scsi_device_realize(DeviceState *dev, Error **errp) void virtio_scsi_common_exit(VirtIOSCSICommon *vs) { - VirtIODevice *vdev = VIRTIO_DEVICE(dev); - VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); + VirtIODevice *vdev = VIRTIO_DEVICE(vs); g_free(vs->cmd_vqs); virtio_cleanup(vdev); diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 4070b37..1dba284 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1156,18 +1156,12 @@ static void virtio_device_realize(DeviceState *dev, Error **errp) VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(dev); Error *err = NULL; - assert(vdc->init != NULL || vdc->realize != NULL); if (vdc->realize != NULL) { vdc->realize(dev, &err); if (err != NULL) { error_propagate(errp, err); return; } - } else { - if (vdc->init(vdev) < 0) { - error_setg(errp, "Device initialization failed."); - return; - } } virtio_bus_device_plugged(vdev); } diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 54c5efe..6da88c0 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -124,12 +124,13 @@ struct VirtIODevice }; typedef struct VirtioDeviceClass { + /*< private >*/ DeviceClass parent; + /*< public >*/ /* This is what a VirtioDevice must implement */ - int (*init)(VirtIODevice *vdev); - void (*exit)(VirtIODevice *vdev); DeviceRealize realize; + void (*exit)(VirtIODevice *vdev); uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features); uint32_t (*bad_features)(VirtIODevice *vdev); void (*set_features)(VirtIODevice *vdev, uint32_t val); -- 1.8.4.2