[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] hw/scsi/vmw_pvscsi: Convert to realize
From: |
Dmitry Fleytman |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] hw/scsi/vmw_pvscsi: Convert to realize |
Date: |
Wed, 26 Jul 2017 12:47:37 +0300 |
> On 26 Jul 2017, at 11:41 AM, Mao Zhongyi <address@hidden> wrote:
>
> Convert a device model where initialization obviously
> can't fail, make it implement realize() rather than init().
Acked-by: Dmitry Fleytman <address@hidden <mailto:address@hidden>>
>
> Cc: Dmitry Fleytman <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> Cc: Markus Armbruster <address@hidden>
> Signed-off-by: Mao Zhongyi <address@hidden>
> ---
> hw/scsi/vmw_pvscsi.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
> index d92973e..77d8b6f 100644
> --- a/hw/scsi/vmw_pvscsi.c
> +++ b/hw/scsi/vmw_pvscsi.c
> @@ -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);
>
> @@ -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
> @@ -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;
> --
> 2.9.4
>
>
>