@samitouri / QOSamiQemu / commits / b87f34aa9f

hw/fsi/aspeed_apb2opb: Convert to DEFINE_TYPES() with inlined TypeInfo

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

Jamin Lin committed Jun 1, 2026 at 02:50 UTC b87f34aa9f17d96c0cc89dc93e857a6b6c5dee64
1 file changed +18 -24
hw/fsi/aspeed_apb2opb.c
+18 -24
@@ -319,20 +319,17 @@ static void fsi_aspeed_apb2opb_class_init(ObjectClass *klass, const void *data)
319 rc->phases.hold = fsi_aspeed_apb2opb_reset_hold;
320 }
321
322 -static const TypeInfo aspeed_apb2opb_info = {
323 - .name = TYPE_ASPEED_APB2OPB,
324 - .parent = TYPE_SYS_BUS_DEVICE,
325 - .instance_init = fsi_aspeed_apb2opb_init,
326 - .instance_size = sizeof(AspeedAPB2OPBState),
327 - .class_init = fsi_aspeed_apb2opb_class_init,
322 +static const TypeInfo aspeed_apb2opb_types[] = {
323 + {
324 + .name = TYPE_ASPEED_APB2OPB,
325 + .parent = TYPE_SYS_BUS_DEVICE,
326 + .instance_init = fsi_aspeed_apb2opb_init,
327 + .instance_size = sizeof(AspeedAPB2OPBState),
328 + .class_init = fsi_aspeed_apb2opb_class_init,
329 + }
330 };
331
330 -static void aspeed_apb2opb_register_types(void)
331 -{
332 - type_register_static(&aspeed_apb2opb_info);
333 -}
334 -
335 -type_init(aspeed_apb2opb_register_types);
332 +DEFINE_TYPES(aspeed_apb2opb_types)
333
334 static void fsi_opb_init(Object *o)
335 {
@@ -363,17 +360,14 @@ static void fsi_opb_class_init(ObjectClass *klass, const void *data)
360 bc->unrealize = fsi_opb_unrealize;
361 }
362
366 -static const TypeInfo opb_info = {
367 - .name = TYPE_OP_BUS,
368 - .parent = TYPE_BUS,
369 - .instance_init = fsi_opb_init,
370 - .instance_size = sizeof(OPBus),
371 - .class_init = fsi_opb_class_init,
363 +static const TypeInfo fsi_opb_types[] = {
364 + {
365 + .name = TYPE_OP_BUS,
366 + .parent = TYPE_BUS,
367 + .instance_init = fsi_opb_init,
368 + .instance_size = sizeof(OPBus),
369 + .class_init = fsi_opb_class_init,
370 + }
371 };
372
374 -static void fsi_opb_register_types(void)
375 -{
376 - type_register_static(&opb_info);
377 -}
378 -
379 -type_init(fsi_opb_register_types);
373 +DEFINE_TYPES(fsi_opb_types)