[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/13] hw/arm/xlnx-zcu102: Replace drive_get_next() by drive_get()
From: |
Markus Armbruster |
Subject: |
[PULL 10/13] hw/arm/xlnx-zcu102: Replace drive_get_next() by drive_get() |
Date: |
Wed, 15 Dec 2021 15:02:19 +0100 |
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-zcu102" connects backends with drive_get_next() in
several counting loops. 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-11-armbru@redhat.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
hw/arm/xlnx-zcu102.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
index 3dc2b5e8ca..45eb19ab3b 100644
--- a/hw/arm/xlnx-zcu102.c
+++ b/hw/arm/xlnx-zcu102.c
@@ -169,7 +169,7 @@ static void xlnx_zcu102_init(MachineState *machine)
/* Create and plug in the SD cards */
for (i = 0; i < XLNX_ZYNQMP_NUM_SDHCI; i++) {
BusState *bus;
- DriveInfo *di = drive_get_next(IF_SD);
+ DriveInfo *di = drive_get(IF_SD, 0, i);
BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
DeviceState *carddev;
char *bus_name;
@@ -190,7 +190,7 @@ static void xlnx_zcu102_init(MachineState *machine)
BusState *spi_bus;
DeviceState *flash_dev;
qemu_irq cs_line;
- DriveInfo *dinfo = drive_get_next(IF_MTD);
+ DriveInfo *dinfo = drive_get(IF_MTD, 0, i);
gchar *bus_name = g_strdup_printf("spi%d", i);
spi_bus = qdev_get_child_bus(DEVICE(&s->soc), bus_name);
@@ -212,7 +212,7 @@ static void xlnx_zcu102_init(MachineState *machine)
BusState *spi_bus;
DeviceState *flash_dev;
qemu_irq cs_line;
- DriveInfo *dinfo = drive_get_next(IF_MTD);
+ DriveInfo *dinfo = drive_get(IF_MTD, 0, XLNX_ZYNQMP_NUM_SPIS + i);
int bus = i / XLNX_ZYNQMP_NUM_QSPI_BUS_CS;
gchar *bus_name = g_strdup_printf("qspi%d", bus);
--
2.31.1
- [PULL 09/13] hw/microblaze: Replace drive_get_next() by drive_get(), (continued)
- [PULL 09/13] hw/microblaze: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 01/13] hw/sd/ssi-sd: Do not create SD card within controller's realize, Markus Armbruster, 2021/12/15
- [PULL 04/13] hw/arm/versatilepb hw/arm/vexpress: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 05/13] hw/arm/imx25_pdk: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 06/13] hw/arm/mcimx6ul-evk: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 08/13] hw/arm/xlnx-versal-virt: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 02/13] hw: Replace trivial drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 03/13] hw/arm/npcm7xx_boards: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 12/13] hw/arm/aspeed: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 07/13] hw/arm/mcimx7d-sabre: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/12/15
- [PULL 10/13] hw/arm/xlnx-zcu102: Replace drive_get_next() by drive_get(),
Markus Armbruster <=
- Re: [PULL 00/13] Block device patches patches for 2021-12-15, Richard Henderson, 2021/12/15