[PATCH v2 31/41] bootmeth_extlinux: Move extlinux_info into plat

Simon Glass sjg at chromium.org
Wed Dec 4 00:45:49 CET 2024


Move this struct into the plat data so that we can use it multiple times
during the boot process.

This struct is missing a comment, so add one.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 boot/bootmeth_extlinux.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
index 569f9d760bf..e2050af8203 100644
--- a/boot/bootmeth_extlinux.c
+++ b/boot/bootmeth_extlinux.c
@@ -22,8 +22,15 @@
 #include <mmc.h>
 #include <pxe_utils.h>
 
+/**
+ * struct extlinux_plat - locate state for this bootmeth
+ *
+ * @use_fallback: true to boot with the fallback option
+ * @info: Info passed to the extlinux_getfile() function
+ */
 struct extlinux_plat {
 	bool use_fallback;
+	struct extlinux_info info;
 };
 
 enum extlinux_option_type {
@@ -175,20 +182,18 @@ static int extlinux_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 
 static int extlinux_boot(struct udevice *dev, struct bootflow *bflow)
 {
+	struct extlinux_plat *plat = dev_get_plat(dev);
 	struct pxe_context ctx;
-	struct extlinux_info info;
-	struct extlinux_plat *plat;
 	ulong addr;
 	int ret;
 
 	addr = map_to_sysmem(bflow->buf);
-	info.dev = dev;
-	info.bflow = bflow;
 
-	plat = dev_get_plat(dev);
+	plat->info.dev = dev;
+	plat->info.bflow = bflow;
 
-	ret = pxe_setup_ctx(&ctx, extlinux_getfile, &info, true, bflow->fname,
-			    false, plat->use_fallback, bflow);
+	ret = pxe_setup_ctx(&ctx, extlinux_getfile, &plat->info, true,
+			    bflow->fname, false, plat->use_fallback, bflow);
 	if (ret)
 		return log_msg_ret("ctx", -EINVAL);
 
-- 
2.34.1



More information about the U-Boot mailing list