mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
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:
parent
3e96ed44e8
commit
6a6638f093
3 changed files with 32 additions and 31 deletions
|
@ -12,7 +12,6 @@
|
|||
#include <bootflow.h>
|
||||
#include <bootmeth.h>
|
||||
#include <bootstd.h>
|
||||
#include <env.h>
|
||||
#include <fs.h>
|
||||
#include <log.h>
|
||||
#include <malloc.h>
|
||||
|
@ -504,34 +503,13 @@ static int build_order(struct udevice *bootstd, struct udevice **order,
|
|||
const char *overflow_target = NULL;
|
||||
const char *const *labels;
|
||||
struct udevice *dev;
|
||||
const char *targets;
|
||||
int i, ret, count;
|
||||
bool ok;
|
||||
|
||||
targets = env_get("boot_targets");
|
||||
labels = IS_ENABLED(CONFIG_BOOTSTD_FULL) ?
|
||||
bootstd_get_bootdev_order(bootstd) : NULL;
|
||||
if (targets) {
|
||||
char str[BOOT_TARGETS_MAX_LEN];
|
||||
char *target;
|
||||
|
||||
if (strlen(targets) >= BOOT_TARGETS_MAX_LEN)
|
||||
return log_msg_ret("len", -E2BIG);
|
||||
|
||||
/* make a copy of the string, since strok() will change it */
|
||||
strcpy(str, targets);
|
||||
for (i = 0, target = strtok(str, " "); target;
|
||||
target = strtok(NULL, " ")) {
|
||||
ret = bootdev_find_by_label(target, &dev);
|
||||
if (!ret) {
|
||||
if (i == max_count) {
|
||||
overflow_target = target;
|
||||
break;
|
||||
}
|
||||
order[i++] = dev;
|
||||
}
|
||||
}
|
||||
count = i;
|
||||
} else if (labels) {
|
||||
labels = bootstd_get_bootdev_order(bootstd, &ok);
|
||||
if (!ok)
|
||||
return log_msg_ret("ord", -ENOMEM);
|
||||
if (labels) {
|
||||
int upto;
|
||||
|
||||
upto = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue