Commit 607659c510 for qemu.org
commit 607659c510598f6d15f030bfc7db3fb561dc73b8
Author: Jamin Lin <jamin_lin@aspeedtech.com>
Date: Mon Jun 1 02:50:25 2026 +0000
hw/rtc/aspeed_rtc: Convert to DEFINE_TYPES() with inlined TypeInfo
Replace the legacy type_register_static()/type_init() registration
pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_rtc_info' TypeInfo variable directly
into the 'aspeed_rtc_types[]' array, removing the need for a separate
declaration.
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-17-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/rtc/aspeed_rtc.c b/hw/rtc/aspeed_rtc.c
index 5245f3f956..34d9fcfa36 100644
--- a/hw/rtc/aspeed_rtc.c
+++ b/hw/rtc/aspeed_rtc.c
@@ -166,16 +166,13 @@ static void aspeed_rtc_class_init(ObjectClass *klass, const void *data)
rc->phases.hold = aspeed_rtc_reset_hold;
}
-static const TypeInfo aspeed_rtc_info = {
- .name = TYPE_ASPEED_RTC,
- .parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(AspeedRtcState),
- .class_init = aspeed_rtc_class_init,
+static const TypeInfo aspeed_rtc_types[] = {
+ {
+ .name = TYPE_ASPEED_RTC,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(AspeedRtcState),
+ .class_init = aspeed_rtc_class_init,
+ }
};
-static void aspeed_rtc_register_types(void)
-{
- type_register_static(&aspeed_rtc_info);
-}
-
-type_init(aspeed_rtc_register_types)
+DEFINE_TYPES(aspeed_rtc_types)