mirror of
https://xff.cz/git/u-boot/
synced 2025-09-29 06:21:15 +02:00
bootstd: Simplify locating existing bootdevs
There is no point in trying to match the alias order for bootdevs, since build_order() either sorts them by priority, uses the boot_targets environment variable or the bootdev-order property. Just use the iterator instead, to simplify the code. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -544,8 +544,8 @@ static int build_order(struct udevice *bootstd, struct udevice **order,
|
|||||||
int bootdev_setup_iter_order(struct bootflow_iter *iter, struct udevice **devp)
|
int bootdev_setup_iter_order(struct bootflow_iter *iter, struct udevice **devp)
|
||||||
{
|
{
|
||||||
struct udevice *bootstd, *dev = *devp, **order;
|
struct udevice *bootstd, *dev = *devp, **order;
|
||||||
int upto, i;
|
struct uclass *uc;
|
||||||
int count;
|
int count, upto;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = uclass_first_device_err(UCLASS_BOOTSTD, &bootstd);
|
ret = uclass_first_device_err(UCLASS_BOOTSTD, &bootstd);
|
||||||
@@ -568,15 +568,9 @@ int bootdev_setup_iter_order(struct bootflow_iter *iter, struct udevice **devp)
|
|||||||
if (!order)
|
if (!order)
|
||||||
return log_msg_ret("order", -ENOMEM);
|
return log_msg_ret("order", -ENOMEM);
|
||||||
|
|
||||||
/*
|
/* Get the list of bootdevs */
|
||||||
* Get a list of bootdevs, in seq order (i.e. using aliases). There may
|
uclass_id_foreach_dev(UCLASS_BOOTDEV, dev, uc)
|
||||||
* be gaps so try to count up high enough to find them all.
|
order[upto++] = dev;
|
||||||
*/
|
|
||||||
for (i = 0, upto = 0; upto < count && i < 20 + count * 2; i++) {
|
|
||||||
ret = uclass_find_device_by_seq(UCLASS_BOOTDEV, i, &dev);
|
|
||||||
if (!ret)
|
|
||||||
order[upto++] = dev;
|
|
||||||
}
|
|
||||||
log_debug("Found %d bootdevs\n", count);
|
log_debug("Found %d bootdevs\n", count);
|
||||||
if (upto != count)
|
if (upto != count)
|
||||||
log_debug("Expected %d bootdevs, found %d using aliases\n",
|
log_debug("Expected %d bootdevs, found %d using aliases\n",
|
||||||
|
Reference in New Issue
Block a user