]> Git Repo - qemu.git/commitdiff
hw/arm/mcimx7d-sabre: Replace drive_get_next() by drive_get()
authorMarkus Armbruster <[email protected]>
Wed, 17 Nov 2021 16:34:03 +0000 (17:34 +0100)
committerMarkus Armbruster <[email protected]>
Wed, 15 Dec 2021 07:38:16 +0000 (08:38 +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 "mcimx7d-sabre" 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: Peter Maydell <[email protected]>
Cc: Andrey Smirnov <[email protected]>
Cc: [email protected]
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20211117163409.3587705[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
hw/arm/mcimx7d-sabre.c

index 935d4b0f1cdf46c2b8c620827211cdac638ac1ee..50a5ecde31a3c16a678b79dbd39eb3eff027d6ce 100644 (file)
@@ -52,7 +52,7 @@ static void mcimx7d_sabre_init(MachineState *machine)
         DriveInfo *di;
         BlockBackend *blk;
 
-        di = drive_get_next(IF_SD);
+        di = drive_get(IF_SD, 0, i);
         blk = di ? blk_by_legacy_dinfo(di) : NULL;
         bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
         carddev = qdev_new(TYPE_SD_CARD);
This page took 0.02839 seconds and 4 git commands to generate.