summaryrefslogtreecommitdiff
path: root/cmd/pxe.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-10-14 21:47:57 +0300
committerTom Rini <trini@konsulko.com>2021-11-12 03:02:14 +0300
commitb1ead6b9087f1f96cb117d72e3e5cf0d5fb708f5 (patch)
treef25a8c8de5539f31d9fb5688ce3d0f10d41cad2e /cmd/pxe.c
parentfd3fa5c3941d4de0736d066f77d0158cf933e207 (diff)
downloadu-boot-b1ead6b9087f1f96cb117d72e3e5cf0d5fb708f5.tar.xz
pxe: Move do_getfile() into the context
Rather than having a global variable, pass the function as part of the context. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'cmd/pxe.c')
-rw-r--r--cmd/pxe.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 17ce54fc04..70dbde3a63 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -24,7 +24,7 @@ const char *pxe_default_paths[] = {
NULL
};
-static int do_get_tftp(struct cmd_tbl *cmdtp, const char *file_path,
+static int do_get_tftp(struct pxe_context *ctx, const char *file_path,
char *file_addr)
{
char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
@@ -32,7 +32,7 @@ static int do_get_tftp(struct cmd_tbl *cmdtp, const char *file_path,
tftp_argv[1] = file_addr;
tftp_argv[2] = (void *)file_path;
- if (do_tftpb(cmdtp, 0, 3, tftp_argv))
+ if (do_tftpb(ctx->cmdtp, 0, 3, tftp_argv))
return -ENOENT;
return 1;
@@ -121,8 +121,7 @@ do_pxe_get(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
struct pxe_context ctx;
int err, i = 0;
- pxe_setup_ctx(&ctx, cmdtp);
- do_getfile = do_get_tftp;
+ pxe_setup_ctx(&ctx, cmdtp, do_get_tftp);
if (argc != 1)
return CMD_RET_USAGE;
@@ -176,8 +175,7 @@ do_pxe_boot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
char *pxefile_addr_str;
struct pxe_context ctx;
- pxe_setup_ctx(&ctx, cmdtp);
- do_getfile = do_get_tftp;
+ pxe_setup_ctx(&ctx, cmdtp, do_get_tftp);
if (argc == 1) {
pxefile_addr_str = from_env("pxefile_addr_r");