summaryrefslogtreecommitdiffstats
path: root/hw/sd/milkymist-memcard.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2020-07-05 22:56:07 +0200
committerPhilippe Mathieu-Daudé2020-08-21 16:22:43 +0200
commitae7ba8e04a4faccfb515c9e6a72892307c4bab1e (patch)
treeed2a078ddef8ef9ca87a329dfae256881d8eeb78 /hw/sd/milkymist-memcard.c
parenthw/lm32/milkymist: Un-inline milkymist_memcard_create() (diff)
downloadqemu-ae7ba8e04a4faccfb515c9e6a72892307c4bab1e.tar.gz
qemu-ae7ba8e04a4faccfb515c9e6a72892307c4bab1e.tar.xz
qemu-ae7ba8e04a4faccfb515c9e6a72892307c4bab1e.zip
hw/sd/milkymist: Create the SDBus at init()
We don't need to wait until realize() to create the SDBus, create it in init() directly. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20200705211016.15241-4-f4bug@amsat.org>
Diffstat (limited to 'hw/sd/milkymist-memcard.c')
-rw-r--r--hw/sd/milkymist-memcard.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
index 11f61294fc..747c5c6136 100644
--- a/hw/sd/milkymist-memcard.c
+++ b/hw/sd/milkymist-memcard.c
@@ -261,6 +261,9 @@ static void milkymist_memcard_init(Object *obj)
memory_region_init_io(&s->regs_region, OBJECT(s), &memcard_mmio_ops, s,
"milkymist-memcard", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region);
+
+ qbus_create_inplace(&s->sdbus, sizeof(s->sdbus), TYPE_SD_BUS,
+ DEVICE(obj), "sd-bus");
}
static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
@@ -271,9 +274,6 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
DriveInfo *dinfo;
Error *err = NULL;
- qbus_create_inplace(&s->sdbus, sizeof(s->sdbus), TYPE_SD_BUS,
- dev, "sd-bus");
-
/* Create and plug in the sd card */
/* FIXME use a qdev drive property instead of drive_get_next() */
dinfo = drive_get_next(IF_SD);