[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 08/13] hw/arm/xlnx-versal-virt: Replace drive_get_next() b
From: |
Edgar E. Iglesias |
Subject: |
Re: [PATCH v2 08/13] hw/arm/xlnx-versal-virt: Replace drive_get_next() by drive_get() |
Date: |
Thu, 18 Nov 2021 15:47:02 +0100 |
On Wed, Nov 17, 2021 at 05:34:04PM +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 "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.
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>
> 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>
> ---
> hw/arm/xlnx-versal-virt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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;
> --
> 2.31.1
>