Commit c8ec9605b8 for qemu.org
commit c8ec9605b8a4f5e0f07e275bb811aba2dad6bd68
Author: Jamin Lin <jamin_lin@aspeedtech.com>
Date: Mon Jun 1 02:50:28 2026 +0000
hw/nvram/aspeed_otp: 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_otp_info' TypeInfo variable directly
into the 'aspeed_otp_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-19-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/nvram/aspeed_otp.c b/hw/nvram/aspeed_otp.c
index 1a9d3841b8..81304bda3a 100644
--- a/hw/nvram/aspeed_otp.c
+++ b/hw/nvram/aspeed_otp.c
@@ -174,16 +174,13 @@ static void aspeed_otp_class_init(ObjectClass *klass, const void *data)
device_class_set_props(dc, aspeed_otp_properties);
}
-static const TypeInfo aspeed_otp_info = {
- .name = TYPE_ASPEED_OTP,
- .parent = TYPE_DEVICE,
- .instance_size = sizeof(AspeedOTPState),
- .class_init = aspeed_otp_class_init,
+static const TypeInfo aspeed_otp_types[] = {
+ {
+ .name = TYPE_ASPEED_OTP,
+ .parent = TYPE_DEVICE,
+ .instance_size = sizeof(AspeedOTPState),
+ .class_init = aspeed_otp_class_init,
+ }
};
-static void aspeed_otp_register_types(void)
-{
- type_register_static(&aspeed_otp_info);
-}
-
-type_init(aspeed_otp_register_types)
+DEFINE_TYPES(aspeed_otp_types)