
Dear Simon Glass,
In message 1329285566-30386-1-git-send-email-sjg@chromium.org you wrote:
At present two parsers have similar code to execute commands. Also cmd_usage() is called all over the place. This series adds a single function which processes commands called cmd_process().
This new function understands return codes, and in particular CMD_RET_USAGE to indicate a usage error. So rather than calling cmd_usage() themselves, the command handlers can just return this error.
There appears to be a run_command2() which is used to run commands with the selected parser. This series changes this in two separate steps to just run_command(), and renames the old run_command() to builtin_run_command(). No one should call this outside main.c since if the hush parser is being used it is wrong to call it. The built-in parser code could move into a separate file perhaps in a future patch.
The overall series reduces code size on ARM by about 1KB on my ~160KB U-Boot text region when the hush parser is used, and around 60 bytes when it isn't.
I tested this on PPC (TQM5200 config):
add/remove: 2/0 grow/shrink: 3/40 up/down: 268/-740 (-472)
and ARM (m28evk config):
add/remove: 1/0 grow/shrink: 5/38 up/down: 212/-1404 (-1192)
so this looks good to me.
Best regards,
Wolfgang Denk