[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 21/21] hw/net/vmxnet3: Merge DeviceRealize in InstanceInit
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 21/21] hw/net/vmxnet3: Merge DeviceRealize in InstanceInit |
Date: |
Thu, 16 Jan 2025 00:22:47 +0100 |
Simplify merging vmxnet3_realize() within vmxnet3_instance_init(),
removing the need for device_class_set_parent_realize().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/net/vmxnet3.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index d8132773fad..2757fd83505 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -2239,6 +2239,7 @@ static void vmxnet3_instance_init(Object *obj)
device_add_bootindex_property(obj, &s->conf.bootindex,
"bootindex", "/ethernet-phy@0",
DEVICE(obj));
+ PCI_DEVICE(obj)->cap_present |= QEMU_PCI_CAP_EXPRESS;
}
static void vmxnet3_pci_uninit(PCIDevice *pci_dev)
@@ -2464,22 +2465,10 @@ static const Property vmxnet3_properties[] = {
DEFINE_NIC_PROPERTIES(VMXNET3State, conf),
};
-static void vmxnet3_realize(DeviceState *qdev, Error **errp)
-{
- VMXNET3Class *vc = VMXNET3_DEVICE_GET_CLASS(qdev);
- PCIDevice *pci_dev = PCI_DEVICE(qdev);
- VMXNET3State *s = VMXNET3(qdev);
-
- pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
-
- vc->parent_dc_realize(qdev, errp);
-}
-
static void vmxnet3_class_init(ObjectClass *class, void *data)
{
DeviceClass *dc = DEVICE_CLASS(class);
PCIDeviceClass *c = PCI_DEVICE_CLASS(class);
- VMXNET3Class *vc = VMXNET3_DEVICE_CLASS(class);
c->realize = vmxnet3_pci_realize;
c->exit = vmxnet3_pci_uninit;
@@ -2490,8 +2479,6 @@ static void vmxnet3_class_init(ObjectClass *class, void
*data)
c->class_id = PCI_CLASS_NETWORK_ETHERNET;
c->subsystem_vendor_id = PCI_VENDOR_ID_VMWARE;
c->subsystem_id = PCI_DEVICE_ID_VMWARE_VMXNET3;
- device_class_set_parent_realize(dc, vmxnet3_realize,
- &vc->parent_dc_realize);
dc->desc = "VMWare Paravirtualized Ethernet v3";
device_class_set_legacy_reset(dc, vmxnet3_qdev_reset);
dc->vmsd = &vmstate_vmxnet3;
--
2.47.1
- [PATCH 15/21] hw/block/fdc-isa: Remove 'fallback' property, (continued)
- [PATCH 15/21] hw/block/fdc-isa: Remove 'fallback' property, Philippe Mathieu-Daudé, 2025/01/15
- [PATCH 16/21] hw/scsi/vmw_pvscsi: Remove PVSCSI_COMPAT_OLD_PCI_CONFIGURATION definition, Philippe Mathieu-Daudé, 2025/01/15
- [PATCH 17/21] hw/scsi/vmw_pvscsi: Remove PVSCSI_COMPAT_DISABLE_PCIE_BIT definition, Philippe Mathieu-Daudé, 2025/01/15
- [PATCH 18/21] hw/scsi/vmw_pvscsi: Convert DeviceRealize -> InstanceInit, Philippe Mathieu-Daudé, 2025/01/15
- [PATCH 19/21] hw/net/vmxnet3: Remove VMXNET3_COMPAT_FLAG_OLD_MSI_OFFSETS definition, Philippe Mathieu-Daudé, 2025/01/15
- [PATCH 21/21] hw/net/vmxnet3: Merge DeviceRealize in InstanceInit,
Philippe Mathieu-Daudé <=
- [PATCH 20/21] hw/net/vmxnet3: Remove VMXNET3_COMPAT_FLAG_DISABLE_PCIE definition, Philippe Mathieu-Daudé, 2025/01/15