Commit d024d4def7 for qemu.org

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

    hw/gpio/aspeed_sgpio: 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 (aspeed_sgpio_info and
    aspeed_sgpio_ast2700_info) directly into the 'aspeed_sgpio_types[]'
    array, removing the need for separate declarations.

    No functional change.

    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-14-jamin_lin@aspeedtech.com
    Signed-off-by: Cédric Le Goater <clg@redhat.com>

diff --git a/hw/gpio/aspeed_sgpio.c b/hw/gpio/aspeed_sgpio.c
index 0c53b03464..7d2f736995 100644
--- a/hw/gpio/aspeed_sgpio.c
+++ b/hw/gpio/aspeed_sgpio.c
@@ -321,26 +321,21 @@ static void aspeed_sgpio_2700_class_init(ObjectClass *klass, const void *data)
     agc->reg_ops = &aspeed_sgpio_2700_ops;
 }

-static const TypeInfo aspeed_sgpio_info = {
-    .name           = TYPE_ASPEED_SGPIO,
-    .parent         = TYPE_SYS_BUS_DEVICE,
-    .instance_size  = sizeof(AspeedSGPIOState),
-    .class_size     = sizeof(AspeedSGPIOClass),
-    .class_init     = aspeed_sgpio_class_init,
-    .abstract       = true,
-};
-
-static const TypeInfo aspeed_sgpio_ast2700_info = {
-    .name           = TYPE_ASPEED_SGPIO "-ast2700",
-    .parent         = TYPE_ASPEED_SGPIO,
-    .class_init     = aspeed_sgpio_2700_class_init,
-    .instance_init  = aspeed_sgpio_init,
+static const TypeInfo aspeed_sgpio_types[] = {
+    {
+        .name           = TYPE_ASPEED_SGPIO,
+        .parent         = TYPE_SYS_BUS_DEVICE,
+        .instance_size  = sizeof(AspeedSGPIOState),
+        .class_size     = sizeof(AspeedSGPIOClass),
+        .class_init     = aspeed_sgpio_class_init,
+        .abstract       = true,
+    },
+    {
+        .name           = TYPE_ASPEED_SGPIO "-ast2700",
+        .parent         = TYPE_ASPEED_SGPIO,
+        .class_init     = aspeed_sgpio_2700_class_init,
+        .instance_init  = aspeed_sgpio_init,
+    }
 };

-static void aspeed_sgpio_register_types(void)
-{
-    type_register_static(&aspeed_sgpio_info);
-    type_register_static(&aspeed_sgpio_ast2700_info);
-}
-
-type_init(aspeed_sgpio_register_types);
+DEFINE_TYPES(aspeed_sgpio_types)