[U-Boot] [PATCH v4 35/42] common: Move command functions out of common.h

Simon Glass sjg at chromium.org
Thu Nov 14 19:57:43 UTC 2019


Move these functions into the command.h header file which is a better fit.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Tom Rini <trini at konsulko.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/mach-kirkwood/cpu.c            |  1 +
 arch/sandbox/cpu/start.c                |  1 +
 board/engicam/common/board.c            |  1 +
 board/gdsys/a38x/keyprogram.c           |  1 +
 board/gdsys/p1022/controlcenterd-id.c   |  1 +
 board/grinn/liteboard/board.c           |  1 +
 board/inversepath/usbarmory/usbarmory.c |  1 +
 board/samsung/common/misc.c             |  1 +
 common/autoboot.c                       |  1 +
 common/cli.c                            |  1 +
 common/cli_simple.c                     |  1 +
 common/main.c                           |  1 +
 common/splash_source.c                  |  1 +
 drivers/fastboot/fb_command.c           |  1 +
 drivers/fastboot/fb_common.c            |  1 +
 drivers/mtd/nand/raw/fsl_elbc_nand.c    |  1 +
 drivers/mtd/nand/raw/fsl_ifc_nand.c     |  1 +
 drivers/net/fsl-mc/mc.c                 |  1 +
 drivers/usb/gadget/f_thor.c             |  1 +
 include/command.h                       | 16 ++++++++++++++++
 include/common.h                        | 17 +----------------
 test/command_ut.c                       |  1 +
 test/dm/sf.c                            |  1 +
 23 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-kirkwood/cpu.c b/arch/arm/mach-kirkwood/cpu.c
index 6ad2543438..29c0e592e4 100644
--- a/arch/arm/mach-kirkwood/cpu.c
+++ b/arch/arm/mach-kirkwood/cpu.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <netdev.h>
 #include <asm/cache.h>
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index cfc542c806..fff9cbdd79 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <errno.h>
 #include <os.h>
 #include <cli.h>
diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
index 0c47afe5b5..31ff297b75 100644
--- a/board/engicam/common/board.c
+++ b/board/engicam/common/board.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <mmc.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/gdsys/a38x/keyprogram.c b/board/gdsys/a38x/keyprogram.c
index 000897984a..853981aadb 100644
--- a/board/gdsys/a38x/keyprogram.c
+++ b/board/gdsys/a38x/keyprogram.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <tpm-v1.h>
 #include <malloc.h>
diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c
index d6798bd338..04d3809566 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -11,6 +11,7 @@
 #endif
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <env.h>
 #include <malloc.h>
diff --git a/board/grinn/liteboard/board.c b/board/grinn/liteboard/board.c
index 1558ea4b84..151041a789 100644
--- a/board/grinn/liteboard/board.c
+++ b/board/grinn/liteboard/board.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2016 Grinn
  */
 
+#include <command.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/imx-regs.h>
diff --git a/board/inversepath/usbarmory/usbarmory.c b/board/inversepath/usbarmory/usbarmory.c
index de4ad83226..19510184d8 100644
--- a/board/inversepath/usbarmory/usbarmory.c
+++ b/board/inversepath/usbarmory/usbarmory.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3ef1e79980..9117669f71 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <lcd.h>
 #include <libtizen.h>
diff --git a/common/autoboot.c b/common/autoboot.c
index 8faac2005d..94a1b4abeb 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -8,6 +8,7 @@
 #include <autoboot.h>
 #include <bootretry.h>
 #include <cli.h>
+#include <command.h>
 #include <console.h>
 #include <env.h>
 #include <fdtdec.h>
diff --git a/common/cli.c b/common/cli.c
index 49b910666b..67ceb635a6 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <cli.h>
 #include <cli_hush.h>
+#include <command.h>
 #include <console.h>
 #include <env.h>
 #include <fdtdec.h>
diff --git a/common/cli_simple.c b/common/cli_simple.c
index 6c881c133c..358e9b7fe1 100644
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <bootretry.h>
 #include <cli.h>
+#include <command.h>
 #include <console.h>
 #include <env.h>
 #include <linux/ctype.h>
diff --git a/common/main.c b/common/main.c
index 3a657c3d9a..a94df7ae04 100644
--- a/common/main.c
+++ b/common/main.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <autoboot.h>
 #include <cli.h>
+#include <command.h>
 #include <console.h>
 #include <env.h>
 #include <version.h>
diff --git a/common/splash_source.c b/common/splash_source.c
index d37b4b304c..2ff15208a7 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <bmp_layout.h>
+#include <command.h>
 #include <env.h>
 #include <errno.h>
 #include <fs.h>
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 4864344853..3c4acfecf6 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <fastboot.h>
 #include <fastboot-internal.h>
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
index e76af8ecc3..c3735a44af 100644
--- a/drivers/fastboot/fb_common.c
+++ b/drivers/fastboot/fb_common.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <fastboot.h>
 #include <net/fastboot.h>
diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
index 263d46ec8f..cbf689af63 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <malloc.h>
 #include <nand.h>
 
diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c
index 29f30d8ccc..e2419e18a9 100644
--- a/drivers/mtd/nand/raw/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <malloc.h>
 #include <nand.h>
 
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 6a9cf51fe4..ffc408e3a4 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -5,6 +5,7 @@
  * Copyright 2017-2018 NXP
  */
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <env.h>
 #include <errno.h>
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index 920fa5279c..5a023a2b34 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -14,6 +14,7 @@
  * Sanghee Kim <sh0130.kim at samsung.com>
  */
 
+#include <command.h>
 #include <errno.h>
 #include <common.h>
 #include <console.h>
diff --git a/include/command.h b/include/command.h
index f6170e7151..d1063774ce 100644
--- a/include/command.h
+++ b/include/command.h
@@ -199,6 +199,22 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size);
  * @return 0 if OK, 1 for error
  */
 int board_run_command(const char *cmdline);
+
+int run_command(const char *cmd, int flag);
+int run_command_repeatable(const char *cmd, int flag);
+
+/**
+ * Run a list of commands separated by ; or even \0
+ *
+ * Note that if 'len' is not -1, then the command does not need to be nul
+ * terminated, Memory will be allocated for the command in that case.
+ *
+ * @param cmd	List of commands to run, each separated bu semicolon
+ * @param len	Length of commands excluding terminator if known (-1 if not)
+ * @param flag	Execution flags (CMD_FLAG_...)
+ * @return 0 on success, or != 0 on error.
+ */
+int run_command_list(const char *cmd, int len, int flag);
 #endif	/* __ASSEMBLY__ */
 
 /*
diff --git a/include/common.h b/include/common.h
index c22eb63501..5bd778a4f4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -3,7 +3,7 @@
  * Common header file for U-Boot
  *
  * This file still includes quite a bit of stuff that should be in separate
- * headers like command.h. Please think before adding more things.
+ * headers. Please think before adding more things.
  * Patches to remove things are welcome.
  *
  * (C) Copyright 2000-2009
@@ -66,21 +66,6 @@ void	hang		(void) __attribute__ ((noreturn));
 
 /* common/main.c */
 void	main_loop	(void);
-int run_command(const char *cmd, int flag);
-int run_command_repeatable(const char *cmd, int flag);
-
-/**
- * Run a list of commands separated by ; or even \0
- *
- * Note that if 'len' is not -1, then the command does not need to be nul
- * terminated, Memory will be allocated for the command in that case.
- *
- * @param cmd	List of commands to run, each separated bu semicolon
- * @param len	Length of commands excluding terminator if known (-1 if not)
- * @param flag	Execution flags (CMD_FLAG_...)
- * @return 0 on success, or != 0 on error.
- */
-int run_command_list(const char *cmd, int len, int flag);
 
 int checkflash(void);
 int checkdram(void);
diff --git a/test/command_ut.c b/test/command_ut.c
index 62f2828b7c..8e268e5ee5 100644
--- a/test/command_ut.c
+++ b/test/command_ut.c
@@ -6,6 +6,7 @@
 #define DEBUG
 
 #include <common.h>
+#include <command.h>
 
 static const char test_cmd[] = "setenv list 1\n setenv list ${list}2; "
 		"setenv list ${list}3\0"
diff --git a/test/dm/sf.c b/test/dm/sf.c
index 65aab4f2e9..7805af740e 100644
--- a/test/dm/sf.c
+++ b/test/dm/sf.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <fdtdec.h>
 #include <mapmem.h>
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog



More information about the U-Boot mailing list