Commit 2bdecefe9b for qemu.org

commit 2bdecefe9bfafee6a1b531579eed800e1816cc5c
Author: Jamin Lin <jamin_lin@aspeedtech.com>
Date:   Mon Jun 1 02:50:35 2026 +0000

    hw/net/ftgmac100: Convert to DEFINE_TYPES() with inlined TypeInfo

    Replace the legacy type_register_static()/type_init() registration
    pattern with the modern DEFINE_TYPES() macro.

    Inline 2 standalone TypeInfo variables (ftgmac100_info,
    aspeed_mii_info) directly into the 'ftgmac100_types[]' array,
    removing the need for separate declarations. Note that this file
    covers both the Faraday FTGMAC100 Gigabit Ethernet controller and
    the Aspeed MII controller, which share the same type registration.

    Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Link: https://lore.kernel.org/qemu-devel/20260601024959.2347639-24-jamin_lin@aspeedtech.com
    Signed-off-by: Cédric Le Goater <clg@redhat.com>

diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
index 2bec817b9d..a53c840c37 100644
--- a/hw/net/ftgmac100.c
+++ b/hw/net/ftgmac100.c
@@ -1279,12 +1279,6 @@ static void ftgmac100_class_init(ObjectClass *klass, const void *data)
     dc->desc = "Faraday FTGMAC100 Gigabit Ethernet emulation";
 }

-static const TypeInfo ftgmac100_info = {
-    .name = TYPE_FTGMAC100,
-    .parent = TYPE_SYS_BUS_DEVICE,
-    .instance_size = sizeof(FTGMAC100State),
-    .class_init = ftgmac100_class_init,
-};

 /*
  * AST2600 MII controller
@@ -1438,17 +1432,19 @@ static void aspeed_mii_class_init(ObjectClass *klass, const void *data)
     device_class_set_props(dc, aspeed_mii_properties);
 }

-static const TypeInfo aspeed_mii_info = {
-    .name = TYPE_ASPEED_MII,
-    .parent = TYPE_SYS_BUS_DEVICE,
-    .instance_size = sizeof(AspeedMiiState),
-    .class_init = aspeed_mii_class_init,
+static const TypeInfo ftgmac100_types[] = {
+    {
+        .name          = TYPE_FTGMAC100,
+        .parent        = TYPE_SYS_BUS_DEVICE,
+        .instance_size = sizeof(FTGMAC100State),
+        .class_init    = ftgmac100_class_init,
+    },
+    {
+        .name          = TYPE_ASPEED_MII,
+        .parent        = TYPE_SYS_BUS_DEVICE,
+        .instance_size = sizeof(AspeedMiiState),
+        .class_init    = aspeed_mii_class_init,
+    }
 };

-static void ftgmac100_register_types(void)
-{
-    type_register_static(&ftgmac100_info);
-    type_register_static(&aspeed_mii_info);
-}
-
-type_init(ftgmac100_register_types)
+DEFINE_TYPES(ftgmac100_types)