[U-Boot] [PATCH 1/2] Create a single cmd_call() function to handle command execution

Simon Glass sjg at chromium.org
Tue Oct 25 15:33:52 CEST 2011


Hi Wolfgang,

On Tue, Oct 25, 2011 at 1:03 AM, Graeme Russ <graeme.russ at gmail.com> wrote:
> Hi Wolfgang,
>
> On 25/10/11 18:46, Wolfgang Denk wrote:
>> Dear Simon Glass,
>>
>> In message <1319514744-18697-1-git-send-email-sjg at 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 <sjg at chromium.org>
>>> ---
>>>  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

What Graeme said :-)

It could probably be done in an inline fashion though to avoid overhead.

Regards,
Simon

>
> Regards,
>
> Graeme
>


More information about the U-Boot mailing list