@samitouri / QOSamiQemu / commits / 686732f397

hw/misc/aspeed_sbc: Convert to DEFINE_TYPES() with inlined TypeInfo

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 <jamin_lin@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/20260601024959.2347639-6-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Jamin Lin committed Jun 1, 2026 at 02:50 UTC 686732f3974fa392ac19379149c47268fd1ef742
1 file changed +20 -26
hw/misc/aspeed_sbc.c
+20 -26
@@ -338,14 +338,6 @@ static void aspeed_sbc_class_init(ObjectClass *klass, const void *data)
338 device_class_set_props(dc, aspeed_sbc_properties);
339 }
340
341 -static const TypeInfo aspeed_sbc_info = {
342 - .name = TYPE_ASPEED_SBC,
343 - .parent = TYPE_SYS_BUS_DEVICE,
344 - .instance_size = sizeof(AspeedSBCState),
345 - .instance_init = aspeed_sbc_instance_init,
346 - .class_init = aspeed_sbc_class_init,
347 - .class_size = sizeof(AspeedSBCClass)
348 -};
341
342 static void aspeed_ast2600_sbc_class_init(ObjectClass *klass, const void *data)
343 {
@@ -356,12 +348,6 @@ static void aspeed_ast2600_sbc_class_init(ObjectClass *klass, const void *data)
348 sc->has_otp = true;
349 }
350
359 -static const TypeInfo aspeed_ast2600_sbc_info = {
360 - .name = TYPE_ASPEED_AST2600_SBC,
361 - .parent = TYPE_ASPEED_SBC,
362 - .class_init = aspeed_ast2600_sbc_class_init,
363 -};
364 -
351 static void aspeed_ast10x0_sbc_class_init(ObjectClass *klass, const void *data)
352 {
353 DeviceClass *dc = DEVICE_CLASS(klass);
@@ -371,17 +357,25 @@ static void aspeed_ast10x0_sbc_class_init(ObjectClass *klass, const void *data)
357 sc->has_otp = true;
358 }
359
374 -static const TypeInfo aspeed_ast10x0_sbc_info = {
375 - .name = TYPE_ASPEED_AST10X0_SBC,
376 - .parent = TYPE_ASPEED_SBC,
377 - .class_init = aspeed_ast10x0_sbc_class_init,
360 +static const TypeInfo aspeed_sbc_types[] = {
361 + {
362 + .name = TYPE_ASPEED_SBC,
363 + .parent = TYPE_SYS_BUS_DEVICE,
364 + .instance_size = sizeof(AspeedSBCState),
365 + .instance_init = aspeed_sbc_instance_init,
366 + .class_init = aspeed_sbc_class_init,
367 + .class_size = sizeof(AspeedSBCClass),
368 + },
369 + {
370 + .name = TYPE_ASPEED_AST10X0_SBC,
371 + .parent = TYPE_ASPEED_SBC,
372 + .class_init = aspeed_ast10x0_sbc_class_init,
373 + },
374 + {
375 + .name = TYPE_ASPEED_AST2600_SBC,
376 + .parent = TYPE_ASPEED_SBC,
377 + .class_init = aspeed_ast2600_sbc_class_init,
378 + }
379 };
380
380 -static void aspeed_sbc_register_types(void)
381 -{
382 - type_register_static(&aspeed_ast2600_sbc_info);
383 - type_register_static(&aspeed_ast10x0_sbc_info);
384 - type_register_static(&aspeed_sbc_info);
385 -}
386 -
387 -type_init(aspeed_sbc_register_types);
381 +DEFINE_TYPES(aspeed_sbc_types)