diff mbox

[U-Boot,6/7] Add bootgraph instrumentation for UBoot commands

Message ID 1314829261-13996-7-git-send-email-amurray@theiet.org
State Superseded
Headers show

Commit Message

Andrew Murray Aug. 31, 2011, 10:21 p.m. UTC
From: Andrew Murray <amurray@mpcdata.com>

This patch adds bootgraph instrumentation for all U_BOOT_CMDs where the
HUSH parser is not used. The patch also adds instrumentation for the
common boot delay.

Signed-off-by: Andrew Murray <amurray@theiet.org>
---
 common/main.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/common/main.c b/common/main.c
index 2730c6f..0c78a94 100644
--- a/common/main.c
+++ b/common/main.c
@@ -273,6 +273,7 @@  void main_loop (void)
 	int rc = 1;
 	int flag;
 #endif
+	int ret;
 
 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
 	char *s;
@@ -376,21 +377,24 @@  void main_loop (void)
 
 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
 
-	if (bootdelay >= 0 && s && !abortboot (bootdelay)) {
+	if (bootdelay >= 0 && s) {
+		DO_INITCALL_RET(abortboot, ret, bootdelay);
+		if (!ret) {
 # ifdef CONFIG_AUTOBOOT_KEYED
-		int prev = disable_ctrlc(1);	/* disable Control C checking */
+			int prev = disable_ctrlc(1);	/* disable Control C checking */
 # endif
 
 # ifndef CONFIG_SYS_HUSH_PARSER
-		run_command (s, 0);
+			run_command (s, 0);
 # else
-		parse_string_outer(s, FLAG_PARSE_SEMICOLON |
+			parse_string_outer(s, FLAG_PARSE_SEMICOLON |
 				    FLAG_EXIT_FROM_LOOP);
 # endif
 
 # ifdef CONFIG_AUTOBOOT_KEYED
-		disable_ctrlc(prev);	/* restore Control C checking */
+			disable_ctrlc(prev);	/* restore Control C checking */
 # endif
+		}
 	}
 
 # ifdef CONFIG_MENUKEY
@@ -1271,7 +1275,7 @@  int run_command (const char *cmd, int flag)
 	char *argv[CONFIG_SYS_MAXARGS + 1];	/* NULL terminated	*/
 	int argc, inquotes;
 	int repeatable = 1;
-	int rc = 0;
+	int rc = 0, ret;
 
 #ifdef DEBUG_PARSER
 	printf ("[RUN_COMMAND] cmd[%p]=\"", cmd);
@@ -1371,7 +1375,8 @@  int run_command (const char *cmd, int flag)
 #endif
 
 		/* OK - call function to do the command */
-		if ((cmdtp->cmd) (cmdtp, flag, argc, argv) != 0) {
+		DO_INITCALL_RET(cmdtp->cmd, ret, cmdtp, flag, argc, argv);
+		if (ret != 0) {
 			rc = -1;
 		}