summaryrefslogtreecommitdiff
path: root/boot/bootflow.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2024-11-15 16:19:12 -0700
committerTom Rini <trini@konsulko.com>2025-01-15 08:48:42 -0600
commit49867e804543f64ca216653c3905d8022c31fc84 (patch)
tree8588bae07829c92ab693f0c1198ff4ccdc5afe39 /boot/bootflow.c
parent6a3eb84b18333eb4beb7e660fa9ae8ccff07b0c4 (diff)
bootstd: Move the bootflow list into an alist
Use an alist for this data structure as it is somewhat simpler to manage. This means that bootstd holds a simple list of bootflow structs and can drop it at will, without chasing down lists. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/bootflow.c')
-rw-r--r--boot/bootflow.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/boot/bootflow.c b/boot/bootflow.c
index 804809dc100..7ce04fd92cd 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -55,11 +55,10 @@ int bootflow_first_glob(struct bootflow **bflowp)
if (ret)
return ret;
- if (list_empty(&std->glob_head))
+ if (!std->bootflows.count)
return -ENOENT;
- *bflowp = list_first_entry(&std->glob_head, struct bootflow,
- glob_node);
+ *bflowp = alist_getw(&std->bootflows, 0, struct bootflow);
return 0;
}
@@ -67,20 +66,16 @@ int bootflow_first_glob(struct bootflow **bflowp)
int bootflow_next_glob(struct bootflow **bflowp)
{
struct bootstd_priv *std;
- struct bootflow *bflow = *bflowp;
int ret;
ret = bootstd_get_priv(&std);
if (ret)
return ret;
- *bflowp = NULL;
-
- if (list_is_last(&bflow->glob_node, &std->glob_head))
+ *bflowp = alist_nextw(&std->bootflows, *bflowp);
+ if (!*bflowp)
return -ENOENT;
- *bflowp = list_entry(bflow->glob_node.next, struct bootflow, glob_node);
-
return 0;
}
@@ -476,10 +471,7 @@ void bootflow_free(struct bootflow *bflow)
void bootflow_remove(struct bootflow *bflow)
{
- list_del(&bflow->glob_node);
-
bootflow_free(bflow);
- free(bflow);
}
#if CONFIG_IS_ENABLED(BOOTSTD_FULL)