aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2021-11-17 17:34:01 +0100
committerMarkus Armbruster <armbru@redhat.com>2021-12-15 08:38:16 +0100
commit6b87668b0813b9cb5ec714dcbcd8f128cfc4a3b1 (patch)
tree361ba409b550421af988d6e272325adfce7fc62e /hw
parentd83c29e98119570880491dacd8dbed9b45a53c5d (diff)
downloadqemu-6b87668b0813b9cb5ec714dcbcd8f128cfc4a3b1.zip
qemu-6b87668b0813b9cb5ec714dcbcd8f128cfc4a3b1.tar.gz
qemu-6b87668b0813b9cb5ec714dcbcd8f128cfc4a3b1.tar.bz2
hw/arm/imx25_pdk: 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 "imx25-pdk" 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: Jean-Christophe Dubois <jcd@tribudubois.net> Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20211117163409.3587705-6-armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/arm/imx25_pdk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
index bd16acd..6dff000 100644
--- a/hw/arm/imx25_pdk.c
+++ b/hw/arm/imx25_pdk.c
@@ -123,7 +123,7 @@ static void imx25_pdk_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->soc.esdhc[i]), "sd-bus");
carddev = qdev_new(TYPE_SD_CARD);