[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/18] target/mips: Declare CPU QOM types using DEFINE_TYPES() ma
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 12/18] target/mips: Declare CPU QOM types using DEFINE_TYPES() macro |
Date: |
Tue, 10 Oct 2023 11:28:54 +0200 |
When multiple QOM types are registered in the same file,
it is simpler to use the the DEFINE_TYPES() macro. In
particular because type array declared with such macro
are easier to review.
In few commits we are going to add more types, so replace
the type_register_static() to ease further reviews.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/mips/cpu.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index a0023edd43..83ee54f766 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -595,17 +595,21 @@ static void mips_cpu_class_init(ObjectClass *c, void
*data)
#endif /* CONFIG_TCG */
}
-static const TypeInfo mips_cpu_type_info = {
- .name = TYPE_MIPS_CPU,
- .parent = TYPE_CPU,
- .instance_size = sizeof(MIPSCPU),
- .instance_align = __alignof(MIPSCPU),
- .instance_init = mips_cpu_initfn,
- .abstract = true,
- .class_size = sizeof(MIPSCPUClass),
- .class_init = mips_cpu_class_init,
+static const TypeInfo mips_cpu_types[] = {
+ {
+ .name = TYPE_MIPS_CPU,
+ .parent = TYPE_CPU,
+ .instance_size = sizeof(MIPSCPU),
+ .instance_align = __alignof(MIPSCPU),
+ .instance_init = mips_cpu_initfn,
+ .abstract = true,
+ .class_size = sizeof(MIPSCPUClass),
+ .class_init = mips_cpu_class_init,
+ }
};
+DEFINE_TYPES(mips_cpu_types)
+
static void mips_cpu_cpudef_class_init(ObjectClass *oc, void *data)
{
MIPSCPUClass *mcc = MIPS_CPU_CLASS(oc);
@@ -630,7 +634,6 @@ static void mips_cpu_register_types(void)
{
int i;
- type_register_static(&mips_cpu_type_info);
for (i = 0; i < mips_defs_number; i++) {
mips_register_cpudef_type(&mips_defs[i]);
}
--
2.41.0
- Re: [PATCH 04/18] target: Declare FOO_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h', (continued)
- [PATCH 05/18] target/hexagon: Declare QOM definitions in 'cpu-qom.h', Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 06/18] target/loongarch: Declare QOM definitions in 'cpu-qom.h', Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 07/18] target/nios2: Declare QOM definitions in 'cpu-qom.h', Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 08/18] target/openrisc: Declare QOM definitions in 'cpu-qom.h', Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 10/18] target/riscv: Inline target specific TYPE_RISCV_CPU_BASE definition, Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 09/18] target/i386: Inline target specific TARGET_DEFAULT_CPU_TYPE definition, Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 12/18] target/mips: Declare CPU QOM types using DEFINE_TYPES() macro,
Philippe Mathieu-Daudé <=
- [PATCH 11/18] target/i386: Declare CPU QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 13/18] target/ppc: Declare CPU QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 14/18] target/sparc: Declare CPU QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 15/18] cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE(), Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 16/18] target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU types, Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 17/18] target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU types, Philippe Mathieu-Daudé, 2023/10/10
- [PATCH 18/18] target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU types, Philippe Mathieu-Daudé, 2023/10/10