Skip to content

Commit

Permalink
hw/scsi/vmw_pvscsi: Convert to realize
Browse files Browse the repository at this point in the history
Convert a device model where initialization obviously
can't fail, make it implement realize() rather than init().

Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Message-Id: <20170726084153.10121-2-maozy.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Mao Zhongyi authored and bonzini committed Aug 1, 2017
1 parent dfaea0c commit fafeb41
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions hw/scsi/vmw_pvscsi.c
Expand Up @@ -1103,8 +1103,8 @@ static const struct SCSIBusInfo pvscsi_scsi_info = {
.cancel = pvscsi_request_cancelled,
};

static int
pvscsi_init(PCIDevice *pci_dev)
static void
pvscsi_realizefn(PCIDevice *pci_dev, Error **errp)
{
PVSCSIState *s = PVSCSI(pci_dev);

Expand Down Expand Up @@ -1144,8 +1144,6 @@ pvscsi_init(PCIDevice *pci_dev)
/* override default SCSI bus hotplug-handler, with pvscsi's one */
qbus_set_hotplug_handler(BUS(&s->bus), DEVICE(s), &error_abort);
pvscsi_reset_state(s);

return 0;
}

static void
Expand Down Expand Up @@ -1278,7 +1276,7 @@ static void pvscsi_class_init(ObjectClass *klass, void *data)
PVSCSIClass *pvs_k = PVSCSI_DEVICE_CLASS(klass);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);

k->init = pvscsi_init;
k->realize = pvscsi_realizefn;
k->exit = pvscsi_uninit;
k->vendor_id = PCI_VENDOR_ID_VMWARE;
k->device_id = PCI_DEVICE_ID_VMWARE_PVSCSI;
Expand Down

0 comments on commit fafeb41

Please sign in to comment.