From mboxrd@z Thu Jan 1 00:00:00 1970 From: Graeme Russ Date: Tue, 25 Oct 2011 19:03:24 +1100 Subject: [U-Boot] [PATCH 1/2] Create a single cmd_call() function to handle command execution In-Reply-To: <20111025074638.1C7081408EA7@gemini.denx.de> References: <1319514744-18697-1-git-send-email-sjg@chromium.org> <20111025074638.1C7081408EA7@gemini.denx.de> Message-ID: <4EA66D4C.8010506@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Wolfgang, On 25/10/11 18:46, Wolfgang Denk wrote: > Dear Simon Glass, > > In message <1319514744-18697-1-git-send-email-sjg@chromium.org> you wrote: >> We should aim for a single point of entry to the commands, whichever >> parser is used. >> >> Signed-off-by: Simon Glass >> --- >> common/command.c | 10 ++++++++++ >> common/hush.c | 9 +++------ >> common/main.c | 3 +-- >> include/command.h | 12 ++++++++++++ >> 4 files changed, 26 insertions(+), 8 deletions(-) >> >> diff --git a/common/command.c b/common/command.c >> index c5cecd3..acc1c15 100644 >> --- a/common/command.c >> +++ b/common/command.c >> @@ -487,3 +487,13 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size) >> } >> } >> #endif >> + >> +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; >> +} > > What exactly is the purpose of this additional function? Except for > the debug() it provides only overhead and no benefit. It provides a single location to issue an XOFF immediately prior to running a (potentially long running) command > I don't think I want to have that. Well it does make things cleaner if we do end up implementing software flow control Regards, Graeme