From: Wolfgang Denk Date: Tue, 06 Mar 2012 20:51:34 +0100 Subject: [U-Boot] [PATCH v5 0/9] Unified command execution in one place In-Reply-To: <1329285566-30386-1-git-send-email-sjg@chromium.org> References: <1329285566-30386-1-git-send-email-sjg@chromium.org> Message-ID: <20120306195134.68D38202D76@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de NOTE: The Most Fundamental Particles in This Product Are Held Together by a "Gluing" Force About Which Little is Currently Known and Whose Adhesive Power Can Therefore Not Be Permanently Guaranteed.