All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, richard.henderson@linaro.org
Subject: [PULL 04/13] hw/arm/versatilepb hw/arm/vexpress: Replace drive_get_next() by drive_get()
Date: Wed, 15 Dec 2021 15:02:13 +0100	[thread overview]
Message-ID: <20211215140222.769652-5-armbru@redhat.com> (raw)
In-Reply-To: <20211215140222.769652-1-armbru@redhat.com>

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.

The versatile and vexpress machines ("versatileab", "versatilepb",
"vexpress-a9", "vexpress-a15") connect just one or two backends of a
type with drive_get_next().  Change them to use drive_get() directly.
This makes the unit numbers explicit in the code.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20211117163409.3587705-5-armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/versatilepb.c | 4 ++--
 hw/arm/vexpress.c    | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 575399c4fc..ecc1f6cf74 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -310,7 +310,7 @@ static void versatile_init(MachineState *machine, int board_id)
     qdev_connect_gpio_out(sysctl, 0, qdev_get_gpio_in(dev, 0));
 
     dev = sysbus_create_varargs("pl181", 0x10005000, sic[22], sic[1], NULL);
-    dinfo = drive_get_next(IF_SD);
+    dinfo = drive_get(IF_SD, 0, 0);
     if (dinfo) {
         DeviceState *card;
 
@@ -322,7 +322,7 @@ static void versatile_init(MachineState *machine, int board_id)
     }
 
     dev = sysbus_create_varargs("pl181", 0x1000b000, sic[23], sic[2], NULL);
-    dinfo = drive_get_next(IF_SD);
+    dinfo = drive_get(IF_SD, 0, 1);
     if (dinfo) {
         DeviceState *card;
 
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 58481c0762..966758cf82 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -625,7 +625,7 @@ static void vexpress_common_init(MachineState *machine)
                           qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT));
     qdev_connect_gpio_out_named(dev, "card-inserted", 0,
                           qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN));
-    dinfo = drive_get_next(IF_SD);
+    dinfo = drive_get(IF_SD, 0, 0);
     if (dinfo) {
         DeviceState *card;
 
@@ -657,7 +657,7 @@ static void vexpress_common_init(MachineState *machine)
 
     sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);
 
-    dinfo = drive_get_next(IF_PFLASH);
+    dinfo = drive_get(IF_PFLASH, 0, 0);
     pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0",
                                        dinfo);
     if (!pflash0) {
@@ -673,7 +673,7 @@ static void vexpress_common_init(MachineState *machine)
         memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias);
     }
 
-    dinfo = drive_get_next(IF_PFLASH);
+    dinfo = drive_get(IF_PFLASH, 0, 1);
     if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1",
                                   dinfo)) {
         error_report("vexpress: error registering flash 1");
-- 
2.31.1



  parent reply	other threads:[~2021-12-15 14:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15 14:02 [PULL 00/13] Block device patches patches for 2021-12-15 Markus Armbruster
2021-12-15 14:02 ` [PULL 01/13] hw/sd/ssi-sd: Do not create SD card within controller's realize Markus Armbruster
2021-12-15 14:02   ` Markus Armbruster
2021-12-15 14:02 ` [PULL 02/13] hw: Replace trivial drive_get_next() by drive_get() Markus Armbruster
2021-12-15 14:02   ` Markus Armbruster
2021-12-15 14:02 ` [PULL 03/13] hw/arm/npcm7xx_boards: Replace " Markus Armbruster
2021-12-15 14:02 ` Markus Armbruster [this message]
2021-12-15 14:02 ` [PULL 05/13] hw/arm/imx25_pdk: " Markus Armbruster
2021-12-15 14:02 ` [PULL 06/13] hw/arm/mcimx6ul-evk: " Markus Armbruster
2021-12-15 14:02 ` [PULL 07/13] hw/arm/mcimx7d-sabre: " Markus Armbruster
2021-12-15 14:02 ` [PULL 08/13] hw/arm/xlnx-versal-virt: " Markus Armbruster
2021-12-15 14:02 ` [PULL 09/13] hw/microblaze: " Markus Armbruster
2021-12-15 14:02 ` [PULL 10/13] hw/arm/xlnx-zcu102: " Markus Armbruster
2021-12-15 14:02 ` [PULL 11/13] hw/arm/xilinx_zynq: " Markus Armbruster
2021-12-15 14:02 ` [PULL 12/13] hw/arm/aspeed: " Markus Armbruster
2021-12-15 14:02 ` [PULL 13/13] blockdev: Drop unused drive_get_next() Markus Armbruster
2021-12-16  1:00 ` [PULL 00/13] Block device patches patches for 2021-12-15 Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211215140222.769652-5-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.