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>
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user