@samitouri / QOSamiQemu / commits / d024d4def7

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>

Jamin Lin committed Jun 1, 2026 at 02:50 UTC d024d4def7e5093158339fe160972aac64c8604b
1 file changed +16 -21
hw/gpio/aspeed_sgpio.c
+16 -21
@@ -321,26 +321,21 @@ static void aspeed_sgpio_2700_class_init(ObjectClass *klass, const void *data)
321 agc->reg_ops = &aspeed_sgpio_2700_ops;
322 }
323
324 -static const TypeInfo aspeed_sgpio_info = {
325 - .name = TYPE_ASPEED_SGPIO,
326 - .parent = TYPE_SYS_BUS_DEVICE,
327 - .instance_size = sizeof(AspeedSGPIOState),
328 - .class_size = sizeof(AspeedSGPIOClass),
329 - .class_init = aspeed_sgpio_class_init,
330 - .abstract = true,
331 -};
332 -
333 -static const TypeInfo aspeed_sgpio_ast2700_info = {
334 - .name = TYPE_ASPEED_SGPIO "-ast2700",
335 - .parent = TYPE_ASPEED_SGPIO,
336 - .class_init = aspeed_sgpio_2700_class_init,
337 - .instance_init = aspeed_sgpio_init,
324 +static const TypeInfo aspeed_sgpio_types[] = {
325 + {
326 + .name = TYPE_ASPEED_SGPIO,
327 + .parent = TYPE_SYS_BUS_DEVICE,
328 + .instance_size = sizeof(AspeedSGPIOState),
329 + .class_size = sizeof(AspeedSGPIOClass),
330 + .class_init = aspeed_sgpio_class_init,
331 + .abstract = true,
332 + },
333 + {
334 + .name = TYPE_ASPEED_SGPIO "-ast2700",
335 + .parent = TYPE_ASPEED_SGPIO,
336 + .class_init = aspeed_sgpio_2700_class_init,
337 + .instance_init = aspeed_sgpio_init,
338 + }
339 };
340
340 -static void aspeed_sgpio_register_types(void)
341 -{
342 - type_register_static(&aspeed_sgpio_info);
343 - type_register_static(&aspeed_sgpio_ast2700_info);
344 -}
345 -
346 -type_init(aspeed_sgpio_register_types);
341 +DEFINE_TYPES(aspeed_sgpio_types)