[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH-for-9.1 01/29] hw/i386/pc: Declare CPU QOM types using DEFINE
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH-for-9.1 01/29] hw/i386/pc: Declare CPU QOM types using DEFINE_TYPES() macro |
Date: |
Thu, 28 Mar 2024 16:54:09 +0100 |
When multiple QOM types are registered in the same file,
it is simpler to use the the DEFINE_TYPES() macro. In
particular because type array declared with such macro
are easier to review.
In few commits we are going to add more types, so replace
the type_register_static() to ease further reviews.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 0be8f08c47..2c41b08478 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1810,23 +1810,20 @@ static void pc_machine_class_init(ObjectClass *oc, void
*data)
pc_machine_set_fd_bootchk);
}
-static const TypeInfo pc_machine_info = {
- .name = TYPE_PC_MACHINE,
- .parent = TYPE_X86_MACHINE,
- .abstract = true,
- .instance_size = sizeof(PCMachineState),
- .instance_init = pc_machine_initfn,
- .class_size = sizeof(PCMachineClass),
- .class_init = pc_machine_class_init,
- .interfaces = (InterfaceInfo[]) {
- { TYPE_HOTPLUG_HANDLER },
- { }
+static const TypeInfo pc_machine_types[] = {
+ {
+ .name = TYPE_PC_MACHINE,
+ .parent = TYPE_X86_MACHINE,
+ .abstract = true,
+ .instance_size = sizeof(PCMachineState),
+ .instance_init = pc_machine_initfn,
+ .class_size = sizeof(PCMachineClass),
+ .class_init = pc_machine_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ },
},
};
-static void pc_machine_register_types(void)
-{
- type_register_static(&pc_machine_info);
-}
-
-type_init(pc_machine_register_types)
+DEFINE_TYPES(pc_machine_types)
--
2.41.0
- [RFC PATCH-for-9.1 00/29] hw/i386/pc: Decouple ISA vs PCI-based machines, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 01/29] hw/i386/pc: Declare CPU QOM types using DEFINE_TYPES() macro,
Philippe Mathieu-Daudé <=
- [RFC PATCH-for-9.1 02/29] hw/i386/pc: Extract pc_machine_is_pci_enabled() helper, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 03/29] hw/i386/pc: Pass base machine type as argument to DEFINE_PC_MACHINE(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 04/29] hw/i386/pc: Introduce PC_PCI_MACHINE QOM type, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 05/29] hw/i386/pc: Remove PCMachineClass::pci_enabled field, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 06/29] hw/i386/pc: Move pci_root_uid field to PcPciMachineClass, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 07/29] hw/i386/pc: Call fw_cfg_add_extra_pci_roots() in pc_pci_machine_done(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 08/29] hw/i386/pc: Move CXLState to PcPciMachineState, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 09/29] hw/i386/pc: Pass PCMachineState argument to acpi_setup(), Philippe Mathieu-Daudé, 2024/03/28