1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

Create a single cmd_call() function to handle command execution

We should aim for a single point of entry to the commands, whichever
parser is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2012-02-14 19:59:23 +00:00
committed by Wolfgang Denk
parent 7fed89e00e
commit bdf8e34b93
4 changed files with 28 additions and 8 deletions

View File

@@ -487,3 +487,24 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
}
}
#endif
/**
* Call a command function. This should be the only route in U-Boot to call
* a command, so that we can track whether we are waiting for input or
* executing a command.
*
* @param cmdtp Pointer to the command to execute
* @param flag Some flags normally 0 (see CMD_FLAG_.. above)
* @param argc Number of arguments (arg 0 must be the command text)
* @param argv Arguments
* @return 0 if command succeeded, else non-zero (CMD_RET_...)
*/
int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int result;
result = (cmdtp->cmd)(cmdtp, flag, argc, argv);
if (result)
debug("Command failed, result=%d", result);
return result;
}