aboutsummaryrefslogtreecommitdiff
path: root/hw/misc
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:32:27 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 22:05:28 +0200
commit8fb9cfe762e6d5d6d9d2241dc4d25475ecd3e77d (patch)
tree51cf4d427f2fa5a10baa0a19fab26cf816534fb7 /hw/misc
parentf4a0df70a23946011c0e435d66530ff919e73b37 (diff)
downloadqemu-8fb9cfe762e6d5d6d9d2241dc4d25475ecd3e77d.zip
qemu-8fb9cfe762e6d5d6d9d2241dc4d25475ecd3e77d.tar.gz
qemu-8fb9cfe762e6d5d6d9d2241dc4d25475ecd3e77d.tar.bz2
macio: Eliminate macio_init_child_obj()
macio_init_child_obj() has become a trivial wrapper around object_initialize_child_with_props(). Eliminate it, since the general convenience wrapper object_initialize_child() is just as convenient already. Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-39-armbru@redhat.com>
Diffstat (limited to 'hw/misc')
-rw-r--r--hw/misc/macio/macio.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 1a07ca2..8ba7af0 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -94,14 +94,6 @@ static void macio_bar_setup(MacIOState *s)
macio_escc_legacy_setup(s);
}
-static void macio_init_child_obj(MacIOState *s, const char *childname,
- void *child, size_t childsize,
- const char *childtype)
-{
- object_initialize_child_with_props(OBJECT(s), childname, child, childsize,
- childtype, &error_abort, NULL);
-}
-
static void macio_common_realize(PCIDevice *d, Error **errp)
{
MacIOState *s = MACIO(d);
@@ -218,13 +210,12 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp)
}
}
-static void macio_init_ide(MacIOState *s, MACIOIDEState *ide, size_t ide_size,
- int index)
+static void macio_init_ide(MacIOState *s, MACIOIDEState *ide, int index)
{
gchar *name = g_strdup_printf("ide[%i]", index);
uint32_t addr = 0x1f000 + ((index + 1) * 0x1000);
- macio_init_child_obj(s, name, ide, ide_size, TYPE_MACIO_IDE);
+ object_initialize_child(OBJECT(s), name, ide, TYPE_MACIO_IDE);
qdev_prop_set_uint32(DEVICE(ide), "addr", addr);
memory_region_add_subregion(&s->bar, addr, &ide->mem);
g_free(name);
@@ -242,16 +233,15 @@ static void macio_oldworld_init(Object *obj)
qdev_prop_allow_set_link_before_realize,
0);
- macio_init_child_obj(s, "cuda", &s->cuda, sizeof(s->cuda), TYPE_CUDA);
+ object_initialize_child(OBJECT(s), "cuda", &s->cuda, TYPE_CUDA);
- macio_init_child_obj(s, "nvram", &os->nvram, sizeof(os->nvram),
- TYPE_MACIO_NVRAM);
+ object_initialize_child(OBJECT(s), "nvram", &os->nvram, TYPE_MACIO_NVRAM);
dev = DEVICE(&os->nvram);
qdev_prop_set_uint32(dev, "size", 0x2000);
qdev_prop_set_uint32(dev, "it_shift", 4);
for (i = 0; i < 2; i++) {
- macio_init_ide(s, &os->ide[i], sizeof(os->ide[i]), i);
+ macio_init_ide(s, &os->ide[i], i);
}
}
@@ -396,11 +386,10 @@ static void macio_newworld_init(Object *obj)
qdev_prop_allow_set_link_before_realize,
0);
- macio_init_child_obj(s, "gpio", &ns->gpio, sizeof(ns->gpio),
- TYPE_MACIO_GPIO);
+ object_initialize_child(OBJECT(s), "gpio", &ns->gpio, TYPE_MACIO_GPIO);
for (i = 0; i < 2; i++) {
- macio_init_ide(s, &ns->ide[i], sizeof(ns->ide[i]), i);
+ macio_init_ide(s, &ns->ide[i], i);
}
}
@@ -413,10 +402,9 @@ static void macio_instance_init(Object *obj)
qbus_create_inplace(&s->macio_bus, sizeof(s->macio_bus), TYPE_MACIO_BUS,
DEVICE(obj), "macio.0");
- macio_init_child_obj(s, "dbdma", &s->dbdma, sizeof(s->dbdma),
- TYPE_MAC_DBDMA);
+ object_initialize_child(OBJECT(s), "dbdma", &s->dbdma, TYPE_MAC_DBDMA);
- macio_init_child_obj(s, "escc", &s->escc, sizeof(s->escc), TYPE_ESCC);
+ object_initialize_child(OBJECT(s), "escc", &s->escc, TYPE_ESCC);
}
static const VMStateDescription vmstate_macio_oldworld = {