cmd: cpu: migrate cpu command to U_BOOT_CMD_WITH_SUBCMDS()
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> Link: https://lore.kernel.org/r/20220531181435.3473549-1-ovpanait@gmail.com Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
parent
d58c007498
commit
15c924a743
39
cmd/cpu.c
39
cmd/cpu.c
@ -82,36 +82,13 @@ static int do_cpu_detail(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct cmd_tbl cmd_cpu_sub[] = {
|
#if CONFIG_IS_ENABLED(SYS_LONGHELP)
|
||||||
U_BOOT_CMD_MKENT(list, 2, 1, do_cpu_list, "", ""),
|
static char cpu_help_text[] =
|
||||||
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",
|
|
||||||
"list - list available CPUs\n"
|
"list - list available CPUs\n"
|
||||||
"cpu detail - show CPU detail"
|
"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));
|
||||||
|
Loading…
Reference in New Issue
Block a user