qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Anton Johansson" <anjo@rev.ng>, "Helge Deller" <deller@gmx.de>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 2/6] hw/hppa: Convert type_init() -> DEFINE_TYPES()
Date: Thu,  9 Oct 2025 16:31:02 +0200	[thread overview]
Message-ID: <20251009143106.22724-3-philmd@linaro.org> (raw)
In-Reply-To: <20251009143106.22724-1-philmd@linaro.org>

Prefer DEFINE_TYPES() macro over type_init() to register
multiple QOM types.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/hppa/machine.c | 42 ++++++++++++++++++------------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 1cce5c47b91..bbee70022f1 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -710,16 +710,6 @@ static void HP_B160L_machine_init_class_init(ObjectClass *oc, const void *data)
     nc->nmi_monitor_handler = hppa_nmi;
 }
 
-static const TypeInfo HP_B160L_machine_init_typeinfo = {
-    .name = MACHINE_TYPE_NAME("B160L"),
-    .parent = TYPE_MACHINE,
-    .class_init = HP_B160L_machine_init_class_init,
-    .interfaces = (const InterfaceInfo[]) {
-        { TYPE_NMI },
-        { }
-    },
-};
-
 static void HP_C3700_machine_init_class_init(ObjectClass *oc, const void *data)
 {
     static const char * const valid_cpu_types[] = {
@@ -746,20 +736,24 @@ static void HP_C3700_machine_init_class_init(ObjectClass *oc, const void *data)
     nc->nmi_monitor_handler = hppa_nmi;
 }
 
-static const TypeInfo HP_C3700_machine_init_typeinfo = {
-    .name = MACHINE_TYPE_NAME("C3700"),
-    .parent = TYPE_MACHINE,
-    .class_init = HP_C3700_machine_init_class_init,
-    .interfaces = (const InterfaceInfo[]) {
-        { TYPE_NMI },
-        { }
+static const TypeInfo hppa_machine_types[] = {
+    {
+        .name = MACHINE_TYPE_NAME("B160L"),
+        .parent = TYPE_MACHINE,
+        .class_init = HP_B160L_machine_init_class_init,
+        .interfaces = (const InterfaceInfo[]) {
+            { TYPE_NMI },
+            { }
+        },
+    }, {
+        .name = MACHINE_TYPE_NAME("C3700"),
+        .parent = TYPE_MACHINE,
+        .class_init = HP_C3700_machine_init_class_init,
+        .interfaces = (const InterfaceInfo[]) {
+            { TYPE_NMI },
+            { }
+        },
     },
 };
 
-static void hppa_machine_init_register_types(void)
-{
-    type_register_static(&HP_B160L_machine_init_typeinfo);
-    type_register_static(&HP_C3700_machine_init_typeinfo);
-}
-
-type_init(hppa_machine_init_register_types)
+DEFINE_TYPES(hppa_machine_types)
-- 
2.51.0



  parent reply	other threads:[~2025-10-09 14:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 14:31 [PATCH 0/6] hw/hppa: Clarify machine variables and move them out of CPUArchState Philippe Mathieu-Daudé
2025-10-09 14:31 ` [PATCH 1/6] hw/hppa: Use the machine default boot order at reset Philippe Mathieu-Daudé
2025-10-09 17:40   ` Richard Henderson
2025-10-09 14:31 ` Philippe Mathieu-Daudé [this message]
2025-10-09 17:07   ` [PATCH 2/6] hw/hppa: Convert type_init() -> DEFINE_TYPES() Richard Henderson
2025-10-09 14:31 ` [PATCH 3/6] hw/hppa: Factor QOM HPPA_COMMON_MACHINE out Philippe Mathieu-Daudé
2025-10-09 17:09   ` Richard Henderson
2025-10-09 14:31 ` [PATCH 4/6] hw/hppa: Introduce HppaMachineState::boot_info::firmware structure Philippe Mathieu-Daudé
2025-10-09 17:20   ` Richard Henderson
2025-10-09 17:25     ` Philippe Mathieu-Daudé
2025-10-09 14:31 ` [PATCH 5/6] hw/hppa: Introduce HppaMachineState::boot_info::kernel structure Philippe Mathieu-Daudé
2025-10-09 14:31 ` [PATCH 6/6] hw/hppa: Move kernel addresses to HppaMachineState::boot_info structure Philippe Mathieu-Daudé

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=20251009143106.22724-3-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=anjo@rev.ng \
    --cc=deller@gmx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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).