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>
---
hw/nvram/aspeed_otp.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
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)
--
2.43.0