[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/7] hw/arm/raspi4b: Declare machine types using DEFINE_TYPES() m
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 1/7] hw/arm/raspi4b: Declare machine types using DEFINE_TYPES() macro |
Date: |
Sat, 1 Feb 2025 10:15:22 +0100 |
When multiple QOM types are registered in the same file,
it is simpler to use the the DEFINE_TYPES() macro. Since
we are going to add more machines, convert type_init()
by DEFINE_TYPES().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/raspi4b.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c
index 1264e0d6eed..5c78d26f957 100644
--- a/hw/arm/raspi4b.c
+++ b/hw/arm/raspi4b.c
@@ -121,16 +121,13 @@ static void raspi4b_machine_class_init(ObjectClass *oc,
void *data)
mc->init = raspi4b_machine_init;
}
-static const TypeInfo raspi4b_machine_type = {
- .name = TYPE_RASPI4B_MACHINE,
- .parent = TYPE_RASPI_BASE_MACHINE,
- .instance_size = sizeof(Raspi4bMachineState),
- .class_init = raspi4b_machine_class_init,
+static const TypeInfo raspi4_machine_types[] = {
+ {
+ .name = TYPE_RASPI4B_MACHINE,
+ .parent = TYPE_RASPI_BASE_MACHINE,
+ .instance_size = sizeof(Raspi4bMachineState),
+ .class_init = raspi4b_machine_class_init,
+ },
};
-static void raspi4b_machine_register_type(void)
-{
- type_register_static(&raspi4b_machine_type);
-}
-
-type_init(raspi4b_machine_register_type)
+DEFINE_TYPES(raspi4_machine_types)
--
2.47.1
- [PATCH 0/7] hw/arm/raspi4b: Add models with 4GB and 8GB of DRAM, Philippe Mathieu-Daudé, 2025/02/01
- [PATCH 1/7] hw/arm/raspi4b: Declare machine types using DEFINE_TYPES() macro,
Philippe Mathieu-Daudé <=
- [PATCH 2/7] hw/arm/raspi4b: Introduce abstract raspi4-base machine type, Philippe Mathieu-Daudé, 2025/02/01
- [PATCH 3/7] hw/arm/raspi4b: Split raspi4b_machine_class_init() in two (1g and 2g), Philippe Mathieu-Daudé, 2025/02/01
- [PATCH 4/7] hw/arm/raspi4b: Rename as raspi4b-1g / raspi4b-2g, deprecating old name, Philippe Mathieu-Daudé, 2025/02/01
- [PATCH 5/7] hw/arm/raspi4b: Expose the raspi4b-1g machine on 64-bit hosts, Philippe Mathieu-Daudé, 2025/02/01
- [PATCH 6/7] hw/arm/raspi4b: Add the raspi4b-4g machine, Philippe Mathieu-Daudé, 2025/02/01
- [PATCH 7/7] hw/arm/raspi4b: Add the raspi4b-8g machine, Philippe Mathieu-Daudé, 2025/02/01
- Re: [PATCH 0/7] hw/arm/raspi4b: Add models with 4GB and 8GB of DRAM, BALATON Zoltan, 2025/02/01