diff mbox series

[v4,09/19] bootmeth_efi: Simplify reading files by using the common function

Message ID 20241115231926.211999-10-sjg@chromium.org
State Accepted
Commit d4c60aa91b8a3a7b880c2a6ec24664108cd67730
Delegated to: Tom Rini
Headers show
Series bootstd: Support recording images | expand

Commit Message

Simon Glass Nov. 15, 2024, 11:19 p.m. UTC
The efiload_read_file() does similar things to a common function, so
update it to use that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---

Changes in v4:
- Make sure that bflow->buf is set correctly

Changes in v2:
- Change the tag to bootmeth_efi

 boot/bootmeth_efi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Simon Glass Dec. 5, 2024, 7:55 p.m. UTC | #1
The efiload_read_file() does similar things to a common function, so
update it to use that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---

Changes in v4:
- Make sure that bflow->buf is set correctly

Changes in v2:
- Change the tag to bootmeth_efi

 boot/bootmeth_efi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Applied to ci/master, thanks!
diff mbox series

Patch

diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index f836aa655f5..47a22d5bd0a 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -89,18 +89,17 @@  static void set_efi_bootdev(struct blk_desc *desc, struct bootflow *bflow)
 static int efiload_read_file(struct bootflow *bflow, ulong addr)
 {
 	struct blk_desc *desc = NULL;
-	loff_t bytes_read;
+	ulong size;
 	int ret;
 
 	if (bflow->blk)
 		 desc = dev_get_uclass_plat(bflow->blk);
-	ret = bootmeth_setup_fs(bflow, desc);
-	if (ret)
-		return log_msg_ret("set", ret);
 
-	ret = fs_read(bflow->fname, addr, 0, bflow->size, &bytes_read);
+	size = SZ_1G;
+	ret = bootmeth_common_read_file(bflow->method, bflow, bflow->fname,
+					addr, &size);
 	if (ret)
-		return log_msg_ret("read", ret);
+		return log_msg_ret("rdf", ret);
 	bflow->buf = map_sysmem(addr, bflow->size);
 
 	set_efi_bootdev(desc, bflow);