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 <[email protected]> --- hw/gpio/aspeed_sgpio.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/hw/gpio/aspeed_sgpio.c b/hw/gpio/aspeed_sgpio.c index 0c53b03464..7d2f736995 100644 --- a/hw/gpio/aspeed_sgpio.c +++ b/hw/gpio/aspeed_sgpio.c @@ -321,26 +321,21 @@ static void aspeed_sgpio_2700_class_init(ObjectClass *klass, const void *data) agc->reg_ops = &aspeed_sgpio_2700_ops; } -static const TypeInfo aspeed_sgpio_info = { - .name = TYPE_ASPEED_SGPIO, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(AspeedSGPIOState), - .class_size = sizeof(AspeedSGPIOClass), - .class_init = aspeed_sgpio_class_init, - .abstract = true, -}; - -static const TypeInfo aspeed_sgpio_ast2700_info = { - .name = TYPE_ASPEED_SGPIO "-ast2700", - .parent = TYPE_ASPEED_SGPIO, - .class_init = aspeed_sgpio_2700_class_init, - .instance_init = aspeed_sgpio_init, +static const TypeInfo aspeed_sgpio_types[] = { + { + .name = TYPE_ASPEED_SGPIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(AspeedSGPIOState), + .class_size = sizeof(AspeedSGPIOClass), + .class_init = aspeed_sgpio_class_init, + .abstract = true, + }, + { + .name = TYPE_ASPEED_SGPIO "-ast2700", + .parent = TYPE_ASPEED_SGPIO, + .class_init = aspeed_sgpio_2700_class_init, + .instance_init = aspeed_sgpio_init, + } }; -static void aspeed_sgpio_register_types(void) -{ - type_register_static(&aspeed_sgpio_info); - type_register_static(&aspeed_sgpio_ast2700_info); -} - -type_init(aspeed_sgpio_register_types); +DEFINE_TYPES(aspeed_sgpio_types) -- 2.43.0
