@samitouri / QOSamiQemu / commits / 2bdecefe9b

hw/net/ftgmac100: 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 (ftgmac100_info, aspeed_mii_info) directly into the 'ftgmac100_types[]' array, removing the need for separate declarations. Note that this file covers both the Faraday FTGMAC100 Gigabit Ethernet controller and the Aspeed MII controller, which share the same type registration. 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-24-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Jamin Lin committed Jun 1, 2026 at 02:50 UTC 2bdecefe9bfafee6a1b531579eed800e1816cc5c
1 file changed +14 -18
hw/net/ftgmac100.c
+14 -18
@@ -1279,12 +1279,6 @@ static void ftgmac100_class_init(ObjectClass *klass, const void *data)
1279 dc->desc = "Faraday FTGMAC100 Gigabit Ethernet emulation";
1280 }
1281
1282 -static const TypeInfo ftgmac100_info = {
1283 - .name = TYPE_FTGMAC100,
1284 - .parent = TYPE_SYS_BUS_DEVICE,
1285 - .instance_size = sizeof(FTGMAC100State),
1286 - .class_init = ftgmac100_class_init,
1287 -};
1282
1283 /*
1284 * AST2600 MII controller
@@ -1438,17 +1432,19 @@ static void aspeed_mii_class_init(ObjectClass *klass, const void *data)
1432 device_class_set_props(dc, aspeed_mii_properties);
1433 }
1434
1441 -static const TypeInfo aspeed_mii_info = {
1442 - .name = TYPE_ASPEED_MII,
1443 - .parent = TYPE_SYS_BUS_DEVICE,
1444 - .instance_size = sizeof(AspeedMiiState),
1445 - .class_init = aspeed_mii_class_init,
1435 +static const TypeInfo ftgmac100_types[] = {
1436 + {
1437 + .name = TYPE_FTGMAC100,
1438 + .parent = TYPE_SYS_BUS_DEVICE,
1439 + .instance_size = sizeof(FTGMAC100State),
1440 + .class_init = ftgmac100_class_init,
1441 + },
1442 + {
1443 + .name = TYPE_ASPEED_MII,
1444 + .parent = TYPE_SYS_BUS_DEVICE,
1445 + .instance_size = sizeof(AspeedMiiState),
1446 + .class_init = aspeed_mii_class_init,
1447 + }
1448 };
1449
1448 -static void ftgmac100_register_types(void)
1449 -{
1450 - type_register_static(&ftgmac100_info);
1451 - type_register_static(&aspeed_mii_info);
1452 -}
1453 -
1454 -type_init(ftgmac100_register_types)
1450 +DEFINE_TYPES(ftgmac100_types)