mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
hw/scsi/vmw_pvscsi: Convert DeviceRealize -> InstanceInit
Simplify replacing pvscsi_realize() by pvscsi_instance_init(), removing the need for device_class_set_parent_realize(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Message-ID: <20250512083948.39294-17-philmd@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
404b27b739
commit
3763d16370
1 changed files with 3 additions and 10 deletions
|
@ -1267,21 +1267,15 @@ static const Property pvscsi_properties[] = {
|
|||
DEFINE_PROP_UINT8("use_msg", PVSCSIState, use_msg, 1),
|
||||
};
|
||||
|
||||
static void pvscsi_realize(DeviceState *qdev, Error **errp)
|
||||
static void pvscsi_instance_init(Object *obj)
|
||||
{
|
||||
PVSCSIClass *pvs_c = PVSCSI_GET_CLASS(qdev);
|
||||
PCIDevice *pci_dev = PCI_DEVICE(qdev);
|
||||
|
||||
pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
|
||||
|
||||
pvs_c->parent_dc_realize(qdev, errp);
|
||||
PCI_DEVICE(obj)->cap_present |= QEMU_PCI_CAP_EXPRESS;
|
||||
}
|
||||
|
||||
static void pvscsi_class_init(ObjectClass *klass, const void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
PVSCSIClass *pvs_k = PVSCSI_CLASS(klass);
|
||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||
|
||||
k->realize = pvscsi_realizefn;
|
||||
|
@ -1290,8 +1284,6 @@ static void pvscsi_class_init(ObjectClass *klass, const void *data)
|
|||
k->device_id = PCI_DEVICE_ID_VMWARE_PVSCSI;
|
||||
k->class_id = PCI_CLASS_STORAGE_SCSI;
|
||||
k->subsystem_id = 0x1000;
|
||||
device_class_set_parent_realize(dc, pvscsi_realize,
|
||||
&pvs_k->parent_dc_realize);
|
||||
device_class_set_legacy_reset(dc, pvscsi_reset);
|
||||
dc->vmsd = &vmstate_pvscsi;
|
||||
device_class_set_props(dc, pvscsi_properties);
|
||||
|
@ -1306,6 +1298,7 @@ static const TypeInfo pvscsi_info = {
|
|||
.class_size = sizeof(PVSCSIClass),
|
||||
.instance_size = sizeof(PVSCSIState),
|
||||
.class_init = pvscsi_class_init,
|
||||
.instance_init = pvscsi_instance_init,
|
||||
.interfaces = (const InterfaceInfo[]) {
|
||||
{ TYPE_HOTPLUG_HANDLER },
|
||||
{ INTERFACE_PCIE_DEVICE },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue