[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 09/13] hw/microblaze: Replace drive_get_next() by drive_ge
From: |
Edgar E. Iglesias |
Subject: |
Re: [PATCH v2 09/13] hw/microblaze: Replace drive_get_next() by drive_get() |
Date: |
Thu, 18 Nov 2021 15:46:52 +0100 |
On Wed, Nov 17, 2021 at 05:34:05PM +0100, Markus Armbruster wrote:
> 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 "petalogix-ml605" 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.
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/microblaze/petalogix_ml605_mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/microblaze/petalogix_ml605_mmu.c
> b/hw/microblaze/petalogix_ml605_mmu.c
> index 159db6cbe2..a24fadddca 100644
> --- a/hw/microblaze/petalogix_ml605_mmu.c
> +++ b/hw/microblaze/petalogix_ml605_mmu.c
> @@ -183,7 +183,7 @@ petalogix_ml605_init(MachineState *machine)
> spi = (SSIBus *)qdev_get_child_bus(dev, "spi");
>
> for (i = 0; i < NUM_SPI_FLASHES; i++) {
> - DriveInfo *dinfo = drive_get_next(IF_MTD);
> + DriveInfo *dinfo = drive_get(IF_MTD, 0, i);
> qemu_irq cs_line;
>
> dev = qdev_new("n25q128");
> --
> 2.31.1
>
- [PATCH v2 00/13] Eliminate drive_get_next(), Markus Armbruster, 2021/11/17
- [PATCH v2 07/13] hw/arm/mcimx7d-sabre: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/11/17
- [PATCH v2 09/13] hw/microblaze: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/11/17
- Re: [PATCH v2 09/13] hw/microblaze: Replace drive_get_next() by drive_get(),
Edgar E. Iglesias <=
- [PATCH v2 04/13] hw/arm/versatilepb hw/arm/vexpress: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/11/17
- [PATCH v2 02/13] hw: Replace trivial drive_get_next() by drive_get(), Markus Armbruster, 2021/11/17
- [PATCH v2 01/13] hw/sd/ssi-sd: Do not create SD card within controller's realize, Markus Armbruster, 2021/11/17
- [PATCH v2 13/13] blockdev: Drop unused drive_get_next(), Markus Armbruster, 2021/11/17
- [PATCH v2 12/13] hw/arm/aspeed: Replace drive_get_next() by drive_get(), Markus Armbruster, 2021/11/17