diff options
author | Simon Glass <sjg@chromium.org> | 2021-10-14 12:47:57 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-11-11 19:02:14 -0500 |
commit | b1ead6b9087f1f96cb117d72e3e5cf0d5fb708f5 (patch) | |
tree | f25a8c8de5539f31d9fb5688ce3d0f10d41cad2e /cmd/pxe.c | |
parent | fd3fa5c3941d4de0736d066f77d0158cf933e207 (diff) | |
download | u-boot-b1ead6b9087f1f96cb117d72e3e5cf0d5fb708f5.tar.gz |
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.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/cmd/pxe.c b/cmd/pxe.c index 17ce54fc049..70dbde3a636 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"); |