dm: cmd: Relocate subcommands when MANUAL_RELOC

Subcommands contain pointers to functions which are not updated when
MANUAL_RELOC is enabled. This patch fix it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Michal Simek 2015-12-04 11:42:01 +01:00
parent e4099c8b80
commit d6df048bca

View File

@ -46,11 +46,25 @@ static cmd_tbl_t test_commands[] = {
U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""), U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
}; };
static __maybe_unused void dm_reloc(void)
{
static int relocated;
if (!relocated) {
fixup_cmdtable(test_commands, ARRAY_SIZE(test_commands));
relocated = 1;
}
}
static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{ {
cmd_tbl_t *test_cmd; cmd_tbl_t *test_cmd;
int ret; int ret;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
dm_reloc();
#endif
if (argc < 2) if (argc < 2)
return CMD_RET_USAGE; return CMD_RET_USAGE;
test_cmd = find_cmd_tbl(argv[1], test_commands, test_cmd = find_cmd_tbl(argv[1], test_commands,