[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 35/40] mips: use object_new() instead of gnew()+o
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v2 35/40] mips: use object_new() instead of gnew()+object_initialize() |
Date: |
Thu, 5 Oct 2017 15:51:09 +0200 |
object_initialize() is intended for inplace initialization of
objects, but here it's first allocated with g_new0() and then
initialized with object_initialize(). QEMU already has API
to do this (object_new), so do object creation with suitable
for usecase API.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
---
CC: address@hidden
CC: address@hidden
CC: address@hidden
---
hw/mips/boston.c | 3 +--
hw/mips/mips_malta.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index 776ee28..e815be6 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -460,7 +460,6 @@ static void boston_mach_init(MachineState *machine)
s = BOSTON(dev);
s->mach = machine;
- s->cps = g_new0(MIPSCPSState, 1);
if (!cpu_supports_cps_smp(cpu_model)) {
error_report("Boston requires CPUs which support CPS");
@@ -469,7 +468,7 @@ static void boston_mach_init(MachineState *machine)
is_64b = cpu_supports_isa(cpu_model, ISA_MIPS64);
- object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);
+ s->cps = MIPS_CPS(object_new(TYPE_MIPS_CPS));
qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());
object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err);
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 2adb9bc..b6a58c7 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -949,9 +949,8 @@ static void create_cps(MaltaState *s, const char *cpu_model,
qemu_irq *cbus_irq, qemu_irq *i8259_irq)
{
Error *err = NULL;
- s->cps = g_new0(MIPSCPSState, 1);
- object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);
+ s->cps = MIPS_CPS(object_new(TYPE_MIPS_CPS));
qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());
object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err);
--
2.7.4
- [Qemu-devel] [PATCH v2 30/40] tricore: use generic cpu_model parsing, (continued)
- [Qemu-devel] [PATCH v2 34/40] sparc: leon3: use generic cpu_model parsing, Igor Mammedov, 2017/10/05
- [Qemu-devel] [PATCH v2 35/40] mips: use object_new() instead of gnew()+object_initialize(),
Igor Mammedov <=
- [Qemu-devel] [PATCH v2 37/40] mips: fulong2e: replace cpu_model with cpu_type, Igor Mammedov, 2017/10/05
- [Qemu-devel] [PATCH v2 40/40] mips: r4k: replace cpu_model with cpu_type, Igor Mammedov, 2017/10/05
- [Qemu-devel] [PATCH v2 36/40] mips: malta/boston: replace cpu_model with cpu_type, Igor Mammedov, 2017/10/05
- [Qemu-devel] [PATCH v2 38/40] mips: Magnum/Acer Pica 61: replace cpu_model with cpu_type, Igor Mammedov, 2017/10/05
- [Qemu-devel] [PATCH v2 39/40] mips: mipssim: replace cpu_model with cpu_type, Igor Mammedov, 2017/10/05
- Re: [Qemu-devel] [PATCH v2 00/40] generalize parsing of cpu_model (part 2), Igor Mammedov, 2017/10/12