Now that PXE can operate without the command line, drop the parameter
throughout the code.

Signed-off-by: Simon Glass <s...@chromium.org>
---

 boot/bootmeth_extlinux.c |  5 ++---
 boot/bootmeth_pxe.c      |  4 +---
 boot/pxe_utils.c         |  8 +++-----
 cmd/pxe.c                |  9 ++++-----
 cmd/sysboot.c            |  4 ++--
 include/extlinux.h       |  1 -
 include/pxe_utils.h      | 10 +++-------
 7 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
index 63cb9a4a8af..ac1efa48a91 100644
--- a/boot/bootmeth_extlinux.c
+++ b/boot/bootmeth_extlinux.c
@@ -173,7 +173,6 @@ static int extlinux_read_bootflow(struct udevice *dev, 
struct bootflow *bflow)
 
 static int extlinux_boot(struct udevice *dev, struct bootflow *bflow)
 {
-       struct cmd_tbl cmdtp = {};      /* dummy */
        struct pxe_context ctx;
        struct extlinux_info info;
        struct extlinux_plat *plat;
@@ -186,8 +185,8 @@ static int extlinux_boot(struct udevice *dev, struct 
bootflow *bflow)
 
        plat = dev_get_plat(dev);
 
-       ret = pxe_setup_ctx(&ctx, &cmdtp, extlinux_getfile, &info, true,
-                           bflow->fname, false, plat->use_fallback);
+       ret = pxe_setup_ctx(&ctx, extlinux_getfile, &info, true, bflow->fname,
+                           false, plat->use_fallback);
        if (ret)
                return log_msg_ret("ctx", -EINVAL);
 
diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c
index c6a132b8de2..59ebf1be83a 100644
--- a/boot/bootmeth_pxe.c
+++ b/boot/bootmeth_pxe.c
@@ -140,7 +140,6 @@ static int extlinux_pxe_read_file(struct udevice *dev, 
struct bootflow *bflow,
 static int extlinux_pxe_boot(struct udevice *dev, struct bootflow *bflow)
 {
        struct pxe_context *ctx = dev_get_priv(dev);
-       struct cmd_tbl cmdtp = {};      /* dummy */
        struct extlinux_info info;
        ulong addr;
        int ret;
@@ -148,8 +147,7 @@ static int extlinux_pxe_boot(struct udevice *dev, struct 
bootflow *bflow)
        addr = map_to_sysmem(bflow->buf);
        info.dev = dev;
        info.bflow = bflow;
-       info.cmdtp = &cmdtp;
-       ret = pxe_setup_ctx(ctx, &cmdtp, extlinux_pxe_getfile, &info, false,
+       ret = pxe_setup_ctx(ctx, extlinux_pxe_getfile, &info, false,
                            bflow->subdir, false, false);
        if (ret)
                return log_msg_ret("ctx", -EINVAL);
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 73d3114813d..8c04f439441 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -1636,16 +1636,14 @@ void handle_pxe_menu(struct pxe_context *ctx, struct 
pxe_menu *cfg)
        boot_unattempted_labels(ctx, cfg);
 }
 
-int pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp,
-                 pxe_getfile_func getfile, void *userdata,
-                 bool allow_abs_path, const char *bootfile, bool use_ipv6,
-                 bool use_fallback)
+int pxe_setup_ctx(struct pxe_context *ctx, pxe_getfile_func getfile,
+                 void *userdata, bool allow_abs_path, const char *bootfile,
+                 bool use_ipv6, bool use_fallback)
 {
        const char *last_slash;
        size_t path_len = 0;
 
        memset(ctx, '\0', sizeof(*ctx));
-       ctx->cmdtp = cmdtp;
        ctx->getfile = getfile;
        ctx->userdata = userdata;
        ctx->allow_abs_path = allow_abs_path;
diff --git a/cmd/pxe.c b/cmd/pxe.c
index c69b8130423..530d5d9c35b 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -126,12 +126,11 @@ static int pxe_ipaddr_paths(struct pxe_context *ctx, 
unsigned long pxefile_addr_
 
 int pxe_get(ulong pxefile_addr_r, char **bootdirp, ulong *sizep, bool use_ipv6)
 {
-       struct cmd_tbl cmdtp[] = {};    /* dummy */
        struct pxe_context ctx;
        int i;
 
-       if (pxe_setup_ctx(&ctx, cmdtp, do_get_tftp, NULL, false,
-                         env_get("bootfile"), use_ipv6, false))
+       if (pxe_setup_ctx(&ctx, do_get_tftp, NULL, false, env_get("bootfile"),
+                         use_ipv6, false))
                return -ENOMEM;
 
        if (IS_ENABLED(CONFIG_BOOTP_PXE_DHCP_OPTION) &&
@@ -280,8 +279,8 @@ do_pxe_boot(struct cmd_tbl *cmdtp, int flag, int argc, char 
*const argv[])
                return 1;
        }
 
-       if (pxe_setup_ctx(&ctx, cmdtp, do_get_tftp, NULL, false,
-                         env_get("bootfile"), use_ipv6, false)) {
+       if (pxe_setup_ctx(&ctx, do_get_tftp, NULL, false, env_get("bootfile"),
+                         use_ipv6, false)) {
                printf("Out of memory\n");
                return CMD_RET_FAILURE;
        }
diff --git a/cmd/sysboot.c b/cmd/sysboot.c
index 93d4a400830..6e899f381ec 100644
--- a/cmd/sysboot.c
+++ b/cmd/sysboot.c
@@ -105,8 +105,8 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int 
argc,
                return 1;
        }
 
-       if (pxe_setup_ctx(&ctx, cmdtp, sysboot_read_file, &info, true,
-                         filename, false, false)) {
+       if (pxe_setup_ctx(&ctx, sysboot_read_file, &info, true, filename, false,
+                         false)) {
                printf("Out of memory\n");
                return CMD_RET_FAILURE;
        }
diff --git a/include/extlinux.h b/include/extlinux.h
index 721ba46371c..6747fe01dda 100644
--- a/include/extlinux.h
+++ b/include/extlinux.h
@@ -18,7 +18,6 @@
 struct extlinux_info {
        struct udevice *dev;
        struct bootflow *bflow;
-       struct cmd_tbl *cmdtp;
 };
 
 #endif
diff --git a/include/pxe_utils.h b/include/pxe_utils.h
index 0378f2889f7..fb057442d5d 100644
--- a/include/pxe_utils.h
+++ b/include/pxe_utils.h
@@ -100,7 +100,6 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, 
const char *file_path,
 /**
  * struct pxe_context - context information for PXE parsing
  *
- * @cmdtp: Pointer to command table to use when calling other commands
  * @getfile: Function called by PXE to read a file
  * @userdata: Data the caller requires for @getfile
  * @allow_abs_path: true to allow absolute paths
@@ -112,7 +111,6 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, 
const char *file_path,
  *     "default" option as default
  */
 struct pxe_context {
-       struct cmd_tbl *cmdtp;
        /**
         * getfile() - read a file
         *
@@ -222,7 +220,6 @@ int format_mac_pxe(char *outbuf, size_t outbuf_len);
  * pxe_setup_ctx() - Setup a new PXE context
  *
  * @ctx: Context to set up
- * @cmdtp: Command table entry which started this action
  * @getfile: Function to call to read a file
  * @userdata: Data the caller requires for @getfile - stored in ctx->userdata
  * @allow_abs_path: true to allow absolute paths
@@ -237,10 +234,9 @@ int format_mac_pxe(char *outbuf, size_t outbuf_len);
  * Return: 0 if OK, -ENOMEM if out of memory, -E2BIG if bootfile is larger than
  *     MAX_TFTP_PATH_LEN bytes
  */
-int pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp,
-                 pxe_getfile_func getfile, void *userdata,
-                 bool allow_abs_path, const char *bootfile, bool use_ipv6,
-                 bool use_fallback);
+int pxe_setup_ctx(struct pxe_context *ctx, pxe_getfile_func getfile,
+                 void *userdata, bool allow_abs_path, const char *bootfile,
+                 bool use_ipv6, bool use_fallback);
 
 /**
  * pxe_destroy_ctx() - Destroy a PXE context
-- 
2.34.1

Reply via email to