From 686732f3974fa392ac19379149c47268fd1ef742 Mon Sep 17 00:00:00 2001 From: Jamin Lin Date: Mon, 1 Jun 2026 02:50:08 +0000 Subject: [PATCH] hw/misc/aspeed_sbc: 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. Inline 3 standalone TypeInfo variables (aspeed_2600_sbc_info, aspeed_ast10x0_sbc_info, aspeed_sbc_info) directly into the 'aspeed_sbc_types[]' array, 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-6-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater --- hw/misc/aspeed_sbc.c | 46 +++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/hw/misc/aspeed_sbc.c b/hw/misc/aspeed_sbc.c index 6125d2f134..1dfcf14e5b 100644 --- a/hw/misc/aspeed_sbc.c +++ b/hw/misc/aspeed_sbc.c @@ -338,14 +338,6 @@ static void aspeed_sbc_class_init(ObjectClass *klass, const void *data) device_class_set_props(dc, aspeed_sbc_properties); } -static const TypeInfo aspeed_sbc_info = { - .name = TYPE_ASPEED_SBC, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(AspeedSBCState), - .instance_init = aspeed_sbc_instance_init, - .class_init = aspeed_sbc_class_init, - .class_size = sizeof(AspeedSBCClass) -}; static void aspeed_ast2600_sbc_class_init(ObjectClass *klass, const void *data) { @@ -356,12 +348,6 @@ static void aspeed_ast2600_sbc_class_init(ObjectClass *klass, const void *data) sc->has_otp = true; } -static const TypeInfo aspeed_ast2600_sbc_info = { - .name = TYPE_ASPEED_AST2600_SBC, - .parent = TYPE_ASPEED_SBC, - .class_init = aspeed_ast2600_sbc_class_init, -}; - static void aspeed_ast10x0_sbc_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -371,17 +357,25 @@ static void aspeed_ast10x0_sbc_class_init(ObjectClass *klass, const void *data) sc->has_otp = true; } -static const TypeInfo aspeed_ast10x0_sbc_info = { - .name = TYPE_ASPEED_AST10X0_SBC, - .parent = TYPE_ASPEED_SBC, - .class_init = aspeed_ast10x0_sbc_class_init, +static const TypeInfo aspeed_sbc_types[] = { + { + .name = TYPE_ASPEED_SBC, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(AspeedSBCState), + .instance_init = aspeed_sbc_instance_init, + .class_init = aspeed_sbc_class_init, + .class_size = sizeof(AspeedSBCClass), + }, + { + .name = TYPE_ASPEED_AST10X0_SBC, + .parent = TYPE_ASPEED_SBC, + .class_init = aspeed_ast10x0_sbc_class_init, + }, + { + .name = TYPE_ASPEED_AST2600_SBC, + .parent = TYPE_ASPEED_SBC, + .class_init = aspeed_ast2600_sbc_class_init, + } }; -static void aspeed_sbc_register_types(void) -{ - type_register_static(&aspeed_ast2600_sbc_info); - type_register_static(&aspeed_ast10x0_sbc_info); - type_register_static(&aspeed_sbc_info); -} - -type_init(aspeed_sbc_register_types); +DEFINE_TYPES(aspeed_sbc_types)