bootstd: Remove special-case code for boot_targets

Rather than implement this as its own case in build_order(), process the
boot_targets environment variable in the bootstd_get_bootdev_order()
function. This allows build_order() to be simplified.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-01-23 18:11:39 -05:00
committed by Tom Rini
parent 3e96ed44e8
commit 6a6638f093
3 changed files with 32 additions and 31 deletions
+16 -1
View File
@@ -10,6 +10,7 @@
#include <bootflow.h>
#include <bootstd.h>
#include <dm.h>
#include <env.h>
#include <log.h>
#include <malloc.h>
#include <dm/device-internal.h>
@@ -72,9 +73,23 @@ static int bootstd_remove(struct udevice *dev)
return 0;
}
const char *const *const bootstd_get_bootdev_order(struct udevice *dev)
const char *const *const bootstd_get_bootdev_order(struct udevice *dev,
bool *okp)
{
struct bootstd_priv *std = dev_get_priv(dev);
const char *targets = env_get("boot_targets");
*okp = true;
log_debug("- targets %s %p\n", targets, std->bootdev_order);
if (targets && *targets) {
str_free_list(std->env_order);
std->env_order = str_to_list(targets);
if (!std->env_order) {
*okp = false;
return NULL;
}
return std->env_order;
}
return std->bootdev_order;
}