]> git.proxmox.com Git - mirror_qemu.git/commit - hw/arm/aspeed.c
hw/arm/aspeed: Replace drive_get_next() by drive_get()
authorMarkus Armbruster <armbru@redhat.com>
Wed, 17 Nov 2021 16:34:08 +0000 (17:34 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 15 Dec 2021 13:56:06 +0000 (14:56 +0100)
commit8ec239f2d80bed82ad5a361ddfb9ca3560a45ad8
tree7a2ad39b7fe9247aac7e88910526c772479c5585
parent94d4bb4ff9c557dcb68cd16a287700dd9218bd1c
hw/arm/aspeed: Replace drive_get_next() by drive_get()

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 aspeed machines connects backends with drive_get_next() in several
counting loops, one of them in a helper function, and a conditional.
Change it to use drive_get() directly.  This makes the unit numbers
explicit in the code.

Cc: "Cédric Le Goater" <clg@kaod.org>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: qemu-arm@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20211117163409.3587705-13-armbru@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
hw/arm/aspeed.c