Replace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_pwm_info' TypeInfo variable directly into the 'aspeed_pwm_types[]' array, removing the need for a separate declaration. No functional change. Signed-off-by: Jamin Lin <[email protected]> --- hw/misc/aspeed_pwm.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/hw/misc/aspeed_pwm.c b/hw/misc/aspeed_pwm.c index 673a0f1346..dfb93ae7fb 100644 --- a/hw/misc/aspeed_pwm.c +++ b/hw/misc/aspeed_pwm.c @@ -106,16 +106,13 @@ static void aspeed_pwm_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_aspeed_pwm; } -static const TypeInfo aspeed_pwm_info = { - .name = TYPE_ASPEED_PWM, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(AspeedPWMState), - .class_init = aspeed_pwm_class_init, +static const TypeInfo aspeed_pwm_types[] = { + { + .name = TYPE_ASPEED_PWM, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(AspeedPWMState), + .class_init = aspeed_pwm_class_init, + } }; -static void aspeed_pwm_register_types(void) -{ - type_register_static(&aspeed_pwm_info); -} - -type_init(aspeed_pwm_register_types); +DEFINE_TYPES(aspeed_pwm_types) -- 2.43.0
