[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 01/18] hw/intc/loongson_ipi: Declare QOM types using DEFINE_TY
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v4 01/18] hw/intc/loongson_ipi: Declare QOM types using DEFINE_TYPES() macro |
Date: |
Thu, 18 Jul 2024 10:38:25 +0200 |
When multiple QOM types are registered in the same file,
it is simpler to use the the DEFINE_TYPES() macro. Replace
the type_init() / type_register_static() combination.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/intc/loongson_ipi.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c
index e6a7142480..dc82caea0d 100644
--- a/hw/intc/loongson_ipi.c
+++ b/hw/intc/loongson_ipi.c
@@ -363,17 +363,14 @@ static void loongson_ipi_finalize(Object *obj)
g_free(s->cpu);
}
-static const TypeInfo loongson_ipi_info = {
- .name = TYPE_LOONGSON_IPI,
- .parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(LoongsonIPI),
- .class_init = loongson_ipi_class_init,
- .instance_finalize = loongson_ipi_finalize,
+static const TypeInfo loongson_ipi_types[] = {
+ {
+ .name = TYPE_LOONGSON_IPI,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(LoongsonIPI),
+ .class_init = loongson_ipi_class_init,
+ .instance_finalize = loongson_ipi_finalize,
+ }
};
-static void loongson_ipi_register_types(void)
-{
- type_register_static(&loongson_ipi_info);
-}
-
-type_init(loongson_ipi_register_types)
+DEFINE_TYPES(loongson_ipi_types)
--
2.41.0
- [PATCH v4 00/18] Reconstruct loongson ipi driver, Philippe Mathieu-Daudé, 2024/07/18
- [PATCH v4 01/18] hw/intc/loongson_ipi: Declare QOM types using DEFINE_TYPES() macro,
Philippe Mathieu-Daudé <=
- [PATCH v4 02/18] hw/intc/loongson_ipi: Access memory in little endian, Philippe Mathieu-Daudé, 2024/07/18
- [PATCH v4 03/18] hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState, Philippe Mathieu-Daudé, 2024/07/18
- [PATCH v4 04/18] hw/intc/loongson_ipi: Extract loongson_ipi_common_finalize(), Philippe Mathieu-Daudé, 2024/07/18
- [PATCH v4 05/18] hw/intc/loongson_ipi: Extract loongson_ipi_common_realize(), Philippe Mathieu-Daudé, 2024/07/18
- [PATCH v4 06/18] hw/intc/loongson_ipi: Add TYPE_LOONGSON_IPI_COMMON stub, Philippe Mathieu-Daudé, 2024/07/18