From b87f34aa9f17d96c0cc89dc93e857a6b6c5dee64 Mon Sep 17 00:00:00 2001 From: Jamin Lin Date: Mon, 1 Jun 2026 02:50:31 +0000 Subject: [PATCH] hw/fsi/aspeed_apb2opb: Convert to DEFINE_TYPES() with inlined TypeInfo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro. This file contains two independent subsystems (aspeed_apb2opb and fsi_opb), each with its own type_init() call. Both are converted to separate DEFINE_TYPES() blocks to preserve the original registration boundary. Inline the standalone 'aspeed_apb2opb_info' and 'fsi_opb_info' TypeInfo variables directly into their respective types arrays, removing the need for separate declarations. No functional change. Signed-off-by: Jamin Lin Reviewed-by: Cédric Le Goater Link: https://lore.kernel.org/qemu-devel/20260601024959.2347639-21-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater --- hw/fsi/aspeed_apb2opb.c | 42 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/hw/fsi/aspeed_apb2opb.c b/hw/fsi/aspeed_apb2opb.c index f2d9a9669a..7a37770a43 100644 --- a/hw/fsi/aspeed_apb2opb.c +++ b/hw/fsi/aspeed_apb2opb.c @@ -319,20 +319,17 @@ static void fsi_aspeed_apb2opb_class_init(ObjectClass *klass, const void *data) rc->phases.hold = fsi_aspeed_apb2opb_reset_hold; } -static const TypeInfo aspeed_apb2opb_info = { - .name = TYPE_ASPEED_APB2OPB, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_init = fsi_aspeed_apb2opb_init, - .instance_size = sizeof(AspeedAPB2OPBState), - .class_init = fsi_aspeed_apb2opb_class_init, +static const TypeInfo aspeed_apb2opb_types[] = { + { + .name = TYPE_ASPEED_APB2OPB, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = fsi_aspeed_apb2opb_init, + .instance_size = sizeof(AspeedAPB2OPBState), + .class_init = fsi_aspeed_apb2opb_class_init, + } }; -static void aspeed_apb2opb_register_types(void) -{ - type_register_static(&aspeed_apb2opb_info); -} - -type_init(aspeed_apb2opb_register_types); +DEFINE_TYPES(aspeed_apb2opb_types) static void fsi_opb_init(Object *o) { @@ -363,17 +360,14 @@ static void fsi_opb_class_init(ObjectClass *klass, const void *data) bc->unrealize = fsi_opb_unrealize; } -static const TypeInfo opb_info = { - .name = TYPE_OP_BUS, - .parent = TYPE_BUS, - .instance_init = fsi_opb_init, - .instance_size = sizeof(OPBus), - .class_init = fsi_opb_class_init, +static const TypeInfo fsi_opb_types[] = { + { + .name = TYPE_OP_BUS, + .parent = TYPE_BUS, + .instance_init = fsi_opb_init, + .instance_size = sizeof(OPBus), + .class_init = fsi_opb_class_init, + } }; -static void fsi_opb_register_types(void) -{ - type_register_static(&opb_info); -} - -type_init(fsi_opb_register_types); +DEFINE_TYPES(fsi_opb_types)