All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 01/14] cmd: cpu: migrate cpu command to U_BOOT_CMD_WITH_SUBCMDS()
@ 2022-05-31 18:14 Ovidiu Panait
  2022-05-31 18:14 ` [PATCH v2 02/14] cpu-uclass: relocate ops pointers for CONFIG_NEEDS_MANUAL_RELOC Ovidiu Panait
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Ovidiu Panait @ 2022-05-31 18:14 UTC (permalink / raw)
  To: u-boot; +Cc: monstr, Ovidiu Panait

Migrate cpu command to use U_BOOT_CMD_WITH_SUBCMDS() helper macro, to
reduce duplicated code. This also fixes the cpu command on boards that
enable CONFIG_NEEDS_MANUAL_RELOC.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
---
NOTE: this series depends on the following "events" patch:
https://lore.kernel.org/u-boot/20220515184029.2169025-2-ovpanait@gmail.com/

Changes in v2:
- New patch.

 cmd/cpu.c | 39 ++++++++-------------------------------
 1 file changed, 8 insertions(+), 31 deletions(-)

diff --git a/cmd/cpu.c b/cmd/cpu.c
index 67dbb044b5..2ca4d05ae8 100644
--- a/cmd/cpu.c
+++ b/cmd/cpu.c
@@ -82,36 +82,13 @@ static int do_cpu_detail(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
-static struct cmd_tbl cmd_cpu_sub[] = {
-	U_BOOT_CMD_MKENT(list, 2, 1, do_cpu_list, "", ""),
-	U_BOOT_CMD_MKENT(detail, 4, 0, do_cpu_detail, "", ""),
-};
-
-/*
- * Process a cpu sub-command
- */
-static int do_cpu(struct cmd_tbl *cmdtp, int flag, int argc,
-		  char *const argv[])
-{
-	struct cmd_tbl *c = NULL;
-
-	/* Strip off leading 'cpu' command argument */
-	argc--;
-	argv++;
-
-	if (argc)
-		c = find_cmd_tbl(argv[0], cmd_cpu_sub,
-				 ARRAY_SIZE(cmd_cpu_sub));
-
-	if (c)
-		return c->cmd(cmdtp, flag, argc, argv);
-	else
-		return CMD_RET_USAGE;
-}
-
-U_BOOT_CMD(
-	cpu, 2, 1, do_cpu,
-	"display information about CPUs",
+#if CONFIG_IS_ENABLED(SYS_LONGHELP)
+static char cpu_help_text[] =
 	"list	- list available CPUs\n"
 	"cpu detail	- show CPU detail"
-);
+	;
+#endif
+
+U_BOOT_CMD_WITH_SUBCMDS(cpu, "display information about CPUs", cpu_help_text,
+	U_BOOT_SUBCMD_MKENT(list, 1, 1, do_cpu_list),
+	U_BOOT_SUBCMD_MKENT(detail, 1, 0, do_cpu_detail));
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-06-07  9:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 18:14 [PATCH v2 01/14] cmd: cpu: migrate cpu command to U_BOOT_CMD_WITH_SUBCMDS() Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 02/14] cpu-uclass: relocate ops pointers for CONFIG_NEEDS_MANUAL_RELOC Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 03/14] microblaze: start.S: remove unused code Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 04/14] microblaze: cache: replace XILINX_USE_DCACHE -> CONFIG_DCACHE Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 05/14] microblaze: cache: improve dcache Kconfig options Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 06/14] microblaze: cache: improve icache " Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 07/14] microblaze: cache: split flush_cache() function Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 08/14] microblaze: cache: introduce Kconfig options for icache/dcache sizes Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 09/14] microblaze: cache: introduce flush_cache_all() Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 10/14] microblaze: cache: introduce cpuinfo structure Ovidiu Panait
2022-06-07  8:40   ` Michal Simek
2022-05-31 18:14 ` [PATCH v2 11/14] microblaze: cache: introduce flush_dcache_range() Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 12/14] microblaze: Kconfig: introduce XILINX_MICROBLAZE0_FPGA_FAMILY option Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 13/14] microblaze: add support for handling PVR data Ovidiu Panait
2022-05-31 18:14 ` [PATCH v2 14/14] cpu: add CPU driver for microblaze Ovidiu Panait
2022-06-07  8:33 ` [PATCH v2 01/14] cmd: cpu: migrate cpu command to U_BOOT_CMD_WITH_SUBCMDS() Michal Simek
2022-06-07  9:55   ` Ovidiu Panait

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.