aboutsummaryrefslogtreecommitdiff
path: root/hw/mips
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:32:36 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 22:06:04 +0200
commit0074fce61fecf40326845fa859119bbdd96df620 (patch)
treed5a578623e7b8b40641ec05d30095ad721c21013 /hw/mips
parentcfe91404c516551de88afbe57433a39dcdacf3c4 (diff)
downloadqemu-0074fce61fecf40326845fa859119bbdd96df620.zip
qemu-0074fce61fecf40326845fa859119bbdd96df620.tar.gz
qemu-0074fce61fecf40326845fa859119bbdd96df620.tar.bz2
sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 1
I'm converting from qdev_set_parent_bus()/realize to qdev_realize(); recent commit "qdev: Convert uses of qdev_set_parent_bus() with Coccinelle" explains why. sysbus_init_child_obj() is a wrapper around object_initialize_child_with_props() and qdev_set_parent_bus(). It passes no properties. Convert sysbus_init_child_obj()/realize to object_initialize_child()/ qdev_realize(). Coccinelle script: @@ expression parent, name, size, type, errp; expression child; symbol true; @@ - sysbus_init_child_obj(parent, name, &child, size, type); + sysbus_init_child_XXX(parent, name, &child, size, type); ... - object_property_set_bool(OBJECT(&child), true, "realized", errp); + sysbus_realize(SYS_BUS_DEVICE(&child), errp); @@ expression parent, name, size, type, errp; expression child; symbol true; @@ - sysbus_init_child_obj(parent, name, child, size, type); + sysbus_init_child_XXX(parent, name, child, size, type); ... - object_property_set_bool(OBJECT(child), true, "realized", errp); + sysbus_realize(SYS_BUS_DEVICE(child), errp); @@ expression parent, name, size, type; expression child; expression dev; expression expr; @@ - sysbus_init_child_obj(parent, name, child, size, type); + sysbus_init_child_XXX(parent, name, child, size, type); ... dev = DEVICE(child); ... when != dev = expr; - qdev_init_nofail(dev); + sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); @@ expression parent, propname, type; expression child; @@ - sysbus_init_child_XXX(parent, propname, child, sizeof(*child), type) + object_initialize_child(parent, propname, child, type) @@ expression parent, propname, type; expression child; @@ - sysbus_init_child_XXX(parent, propname, &child, sizeof(child), type) + object_initialize_child(parent, propname, &child, type) Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-48-armbru@redhat.com>
Diffstat (limited to 'hw/mips')
-rw-r--r--hw/mips/boston.c6
-rw-r--r--hw/mips/cps.c20
-rw-r--r--hw/mips/malta.c6
3 files changed, 12 insertions, 20 deletions
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index 03008b5..f5d4ac8 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -454,14 +454,12 @@ static void boston_mach_init(MachineState *machine)
is_64b = cpu_supports_isa(machine->cpu_type, ISA_MIPS64);
- sysbus_init_child_obj(OBJECT(machine), "cps", &s->cps, sizeof(s->cps),
- TYPE_MIPS_CPS);
+ object_initialize_child(OBJECT(machine), "cps", &s->cps, TYPE_MIPS_CPS);
object_property_set_str(OBJECT(&s->cps), machine->cpu_type, "cpu-type",
&error_fatal);
object_property_set_int(OBJECT(&s->cps), machine->smp.cpus, "num-vp",
&error_fatal);
- object_property_set_bool(OBJECT(&s->cps), true, "realized",
- &error_fatal);
+ sysbus_realize(SYS_BUS_DEVICE(&s->cps), &error_fatal);
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
diff --git a/hw/mips/cps.c b/hw/mips/cps.c
index 92b9b1a..cdfab19 100644
--- a/hw/mips/cps.c
+++ b/hw/mips/cps.c
@@ -99,8 +99,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
/* Inter-Thread Communication Unit */
if (itu_present) {
- sysbus_init_child_obj(OBJECT(dev), "itu", &s->itu, sizeof(s->itu),
- TYPE_MIPS_ITU);
+ object_initialize_child(OBJECT(dev), "itu", &s->itu, TYPE_MIPS_ITU);
object_property_set_int(OBJECT(&s->itu), 16, "num-fifo", &err);
object_property_set_int(OBJECT(&s->itu), 16, "num-semaphores", &err);
object_property_set_bool(OBJECT(&s->itu), saar_present, "saar-present",
@@ -108,7 +107,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
if (saar_present) {
s->itu.saar = &env->CP0_SAAR;
}
- object_property_set_bool(OBJECT(&s->itu), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->itu), &err);
if (err != NULL) {
error_propagate(errp, err);
return;
@@ -119,11 +118,10 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
}
/* Cluster Power Controller */
- sysbus_init_child_obj(OBJECT(dev), "cpc", &s->cpc, sizeof(s->cpc),
- TYPE_MIPS_CPC);
+ object_initialize_child(OBJECT(dev), "cpc", &s->cpc, TYPE_MIPS_CPC);
object_property_set_int(OBJECT(&s->cpc), s->num_vp, "num-vp", &err);
object_property_set_int(OBJECT(&s->cpc), 1, "vp-start-running", &err);
- object_property_set_bool(OBJECT(&s->cpc), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->cpc), &err);
if (err != NULL) {
error_propagate(errp, err);
return;
@@ -133,11 +131,10 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->cpc), 0));
/* Global Interrupt Controller */
- sysbus_init_child_obj(OBJECT(dev), "gic", &s->gic, sizeof(s->gic),
- TYPE_MIPS_GIC);
+ object_initialize_child(OBJECT(dev), "gic", &s->gic, TYPE_MIPS_GIC);
object_property_set_int(OBJECT(&s->gic), s->num_vp, "num-vp", &err);
object_property_set_int(OBJECT(&s->gic), 128, "num-irq", &err);
- object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->gic), &err);
if (err != NULL) {
error_propagate(errp, err);
return;
@@ -149,14 +146,13 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
/* Global Configuration Registers */
gcr_base = env->CP0_CMGCRBase << 4;
- sysbus_init_child_obj(OBJECT(dev), "gcr", &s->gcr, sizeof(s->gcr),
- TYPE_MIPS_GCR);
+ object_initialize_child(OBJECT(dev), "gcr", &s->gcr, TYPE_MIPS_GCR);
object_property_set_int(OBJECT(&s->gcr), s->num_vp, "num-vp", &err);
object_property_set_int(OBJECT(&s->gcr), 0x800, "gcr-rev", &err);
object_property_set_int(OBJECT(&s->gcr), gcr_base, "gcr-base", &err);
object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->gic.mr), "gic", &err);
object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->cpc.mr), "cpc", &err);
- object_property_set_bool(OBJECT(&s->gcr), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->gcr), &err);
if (err != NULL) {
error_propagate(errp, err);
return;
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 7df4768..d95926a 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -1183,14 +1183,12 @@ static void create_cpu_without_cps(MachineState *ms,
static void create_cps(MachineState *ms, MaltaState *s,
qemu_irq *cbus_irq, qemu_irq *i8259_irq)
{
- sysbus_init_child_obj(OBJECT(s), "cps", &s->cps, sizeof(s->cps),
- TYPE_MIPS_CPS);
+ object_initialize_child(OBJECT(s), "cps", &s->cps, TYPE_MIPS_CPS);
object_property_set_str(OBJECT(&s->cps), ms->cpu_type, "cpu-type",
&error_fatal);
object_property_set_int(OBJECT(&s->cps), ms->smp.cpus, "num-vp",
&error_fatal);
- object_property_set_bool(OBJECT(&s->cps), true, "realized",
- &error_fatal);
+ sysbus_realize(SYS_BUS_DEVICE(&s->cps), &error_fatal);
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);