qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Xiaoyao Li" <xiaoyao.li@intel.com>
Subject: [PULL 23/27] hw/scsi/vmw_pvscsi: Convert DeviceRealize -> InstanceInit
Date: Wed, 28 May 2025 12:05:03 +0200	[thread overview]
Message-ID: <20250528100507.313906-24-thuth@redhat.com> (raw)
In-Reply-To: <20250528100507.313906-1-thuth@redhat.com>

From: Philippe Mathieu-Daudé <philmd@linaro.org>

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>
---
 hw/scsi/vmw_pvscsi.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index e163023d14c..7c98b1b8ea6 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -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 },
-- 
2.49.0



  parent reply	other threads:[~2025-05-28 10:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28 10:04 [PULL 00/27] Functional tests, Microblaze endianness & pc/q35 cleanups Thomas Huth
2025-05-28 10:04 ` [PULL 01/27] tests/functional/test_sparc64_tuxrun: Explicitly set the 'sun4u' machine Thomas Huth
2025-05-28 10:04 ` [PULL 02/27] tests/functional/test_mips_malta: Re-enable the check for the PCI host bridge Thomas Huth
2025-05-28 10:04 ` [PULL 03/27] tests/functional/test_mem_addr_space: Use set_machine() to select the machine Thomas Huth
2025-05-28 10:04 ` [PULL 04/27] tests/functional: add skipLockedMemoryTest decorator Thomas Huth
2025-05-28 10:04 ` [PULL 05/27] tests/functional: add memlock tests Thomas Huth
2025-05-28 10:04 ` [PULL 06/27] hw/microblaze: Add endianness property to the petalogix_s3adsp1800 machine Thomas Huth
2025-05-28 10:04 ` [PULL 07/27] tests/functional: Test both microblaze s3adsp1800 endianness variants Thomas Huth
2025-05-28 10:04 ` [PULL 08/27] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu Thomas Huth
2025-05-28 10:04 ` [PULL 09/27] docs: Deprecate the qemu-system-microblazeel binary Thomas Huth
2025-05-28 10:04 ` [PULL 10/27] hw/i386/pc: Remove deprecated pc-q35-2.4 and pc-i440fx-2.4 machines Thomas Huth
2025-05-28 10:04 ` [PULL 11/27] hw/i386/pc: Remove PCMachineClass::broken_reserved_end field Thomas Huth
2025-05-28 10:04 ` [PULL 12/27] hw/i386/pc: Remove pc_compat_2_4[] array Thomas Huth
2025-05-28 10:04 ` [PULL 13/27] hw/core/machine: Remove hw_compat_2_4[] array Thomas Huth
2025-05-28 10:04 ` [PULL 14/27] hw/net/e1000: Remove unused E1000_FLAG_MAC flag Thomas Huth
2025-05-28 10:04 ` [PULL 15/27] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_MIGRATE_EXTRA definition Thomas Huth
2025-05-28 10:04 ` [PULL 16/27] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_DISABLE_PCIE definition Thomas Huth
2025-05-28 10:04 ` [PULL 17/27] hw/i386/pc: Remove deprecated pc-q35-2.5 and pc-i440fx-2.5 machines Thomas Huth
2025-05-28 10:04 ` [PULL 18/27] hw/i386/x86: Remove X86MachineClass::save_tsc_khz field Thomas Huth
2025-05-28 10:04 ` [PULL 19/27] hw/nvram/fw_cfg: Remove legacy FW_CFG_ORDER_OVERRIDE Thomas Huth
2025-05-28 10:05 ` [PULL 20/27] hw/core/machine: Remove hw_compat_2_5[] array Thomas Huth
2025-05-28 10:05 ` [PULL 21/27] hw/scsi/vmw_pvscsi: Remove PVSCSI_COMPAT_OLD_PCI_CONFIGURATION definition Thomas Huth
2025-05-28 10:05 ` [PULL 22/27] hw/scsi/vmw_pvscsi: Remove PVSCSI_COMPAT_DISABLE_PCIE_BIT definition Thomas Huth
2025-05-28 10:05 ` Thomas Huth [this message]
2025-05-28 10:05 ` [PULL 24/27] hw/net/vmxnet3: Remove VMXNET3_COMPAT_FLAG_OLD_MSI_OFFSETS definition Thomas Huth
2025-05-28 10:05 ` [PULL 25/27] hw/net/vmxnet3: Remove VMXNET3_COMPAT_FLAG_DISABLE_PCIE definition Thomas Huth
2025-05-28 10:05 ` [PULL 26/27] hw/net/vmxnet3: Merge DeviceRealize in InstanceInit Thomas Huth
2025-05-28 10:05 ` [PULL 27/27] tests/unit/test-util-sockets: fix mem-leak on error object Thomas Huth
2025-05-28 19:23 ` [PULL 00/27] Functional tests, Microblaze endianness & pc/q35 cleanups Stefan Hajnoczi
2025-05-28 20:12   ` Thomas Huth
2025-06-04  7:51     ` Alexandr Moshkov
2025-06-04 13:11       ` Stefan Hajnoczi
2025-06-04 13:19         ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250528100507.313906-24-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=berrange@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xiaoyao.li@intel.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).