From ae7ba8e04a4faccfb515c9e6a72892307c4bab1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sun, 5 Jul 2020 22:56:07 +0200 Subject: [PATCH] hw/sd/milkymist: Create the SDBus at init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need to wait until realize() to create the SDBus, create it in init() directly. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-Id: <20200705211016.15241-4-f4bug@amsat.org> --- hw/sd/milkymist-memcard.c | 6 +++--- 1 file 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);