aboutsummaryrefslogtreecommitdiff
path: root/hw/arm
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2021-11-17 17:34:04 +0100
committerMarkus Armbruster <armbru@redhat.com>2021-12-15 08:38:16 +0100
commitc29faeda3f7e770e463a58f7b5b34b409dba6c88 (patch)
tree0e6b74dc3b51b3513863b442447ad3848f38d51e /hw/arm
parent50659fc479977a7576c0cf0589c7fa31dabe0ad9 (diff)
hw/arm/xlnx-versal-virt: 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 "xlnx-versal-virt" 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: Alistair Francis <alistair@alistair23.me> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20211117163409.3587705-9-armbru@redhat.com> Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Diffstat (limited to 'hw/arm')
-rw-r--r--hw/arm/xlnx-versal-virt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index d2f55e29b6..0c5edc898e 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -669,7 +669,8 @@ static void versal_virt_init(MachineState *machine)
/* Plugin SD cards. */
for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) {
- sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD));
+ sd_plugin_card(&s->soc.pmc.iou.sd[i],
+ drive_get(IF_SD, 0, i));
}
s->binfo.ram_size = machine->ram_size;