summaryrefslogtreecommitdiffstats
path: root/hw/arm/mcimx7d-sabre.c
diff options
context:
space:
mode:
authorMarkus Armbruster2021-11-17 17:34:03 +0100
committerMarkus Armbruster2021-12-15 08:38:16 +0100
commit50659fc479977a7576c0cf0589c7fa31dabe0ad9 (patch)
tree57d2ffab0c45b7c4ef55e364aabe7fbb54053218 /hw/arm/mcimx7d-sabre.c
parenthw/arm/mcimx6ul-evk: Replace drive_get_next() by drive_get() (diff)
downloadqemu-50659fc479977a7576c0cf0589c7fa31dabe0ad9.tar.gz
qemu-50659fc479977a7576c0cf0589c7fa31dabe0ad9.tar.xz
qemu-50659fc479977a7576c0cf0589c7fa31dabe0ad9.zip
hw/arm/mcimx7d-sabre: Replace drive_get_next() by drive_get()
drive_get_next() is basically a bad idea. It returns the "next" block backend of a certain interface type. "Next" means bus=0,unit=N, where subsequent calls count N up from zero, per interface type. This lets you define unit numbers implicitly by execution order. If the order changes, or new calls appear "in the middle", unit numbers change. ABI break. Hard to spot in review. Machine "mcimx7d-sabre" connects backends with drive_get_next() in a counting loop. Change it to use drive_get() directly. This makes the unit numbers explicit in the code. Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20211117163409.3587705-8-armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/mcimx7d-sabre.c')
-rw-r--r--hw/arm/mcimx7d-sabre.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c
index 935d4b0f1c..50a5ecde31 100644
--- a/hw/arm/mcimx7d-sabre.c
+++ b/hw/arm/mcimx7d-sabre.c
@@ -52,7 +52,7 @@ static void mcimx7d_sabre_init(MachineState *machine)
DriveInfo *di;
BlockBackend *blk;
- di = drive_get_next(IF_SD);
+ di = drive_get(IF_SD, 0, i);
blk = di ? blk_by_legacy_dinfo(di) : NULL;
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
carddev = qdev_new(TYPE_SD_CARD);