diff mbox series

[10/11] hw/arm/orangepi: Define machine as generic QOM type

Message ID 20250417235814.98677-11-philmd@linaro.org
State New
Headers show
Series hw/arm: Define machines as generic QOM types | expand

Commit Message

Philippe Mathieu-Daudé April 17, 2025, 11:58 p.m. UTC
While DEFINE_MACHINE() is a succinct macro, it doesn't
allow registering QOM interfaces to the defined machine.
Convert to the generic DEFINE_TYPES() in preparation to
register interfaces.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/orangepi.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c
index e0956880d11..6821033bfd7 100644
--- a/hw/arm/orangepi.c
+++ b/hw/arm/orangepi.c
@@ -103,12 +103,13 @@  static void orangepi_init(MachineState *machine)
     arm_load_kernel(&h3->cpus[0], machine, &orangepi_binfo);
 }
 
-static void orangepi_machine_init(MachineClass *mc)
+static void orangepi_machine_class_init(ObjectClass *oc, void *data)
 {
     static const char * const valid_cpu_types[] = {
         ARM_CPU_TYPE_NAME("cortex-a7"),
         NULL
     };
+    MachineClass *mc = MACHINE_CLASS(oc);
 
     mc->desc = "Orange Pi PC (Cortex-A7)";
     mc->init = orangepi_init;
@@ -124,4 +125,12 @@  static void orangepi_machine_init(MachineClass *mc)
     mc->auto_create_sdcard = true;
 }
 
-DEFINE_MACHINE("orangepi-pc", orangepi_machine_init)
+static const TypeInfo orangepi_machine_types[] = {
+    {
+        .name           = MACHINE_TYPE_NAME("orangepi-pc"),
+        .parent         = TYPE_MACHINE,
+        .class_init     = orangepi_machine_class_init,
+    },
+};
+
+DEFINE_TYPES(orangepi_machine_types)