Skip to contentSkip to conversation

U-Boot-V2: parser.c sparse cleanup

PATCH Superseded Menon 2 participants 3 messages May 12, 2008

lore
Share & tools
lore

Menon

#0 lore raw

PATCH 1/1 U-Boot-V2: parser.c sparse cleanup

This patch cleans up the parser error seen during simple parser compilation.
Please note that CFG_CMD_BOOTD is not defined at the moment, but leaving it for addition at a later point of time.

common/parser.c +3 -3
Index: u-boot-v2.git/common/parser.c
===================================================================
@@ -2,7 +2,7 @@
 #include <command.h>
 #include <environment.h>
 
-int parse_line (char *line, char *argv[])
+static int parse_line (char *line, char *argv[])
 {
 	int nargs = 0;
 
@@ -265,7 +265,7 @@
 			continue;
 		}
 
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
+#if defined(CONFIG_COMMANDS) & defined(CONFIG_CMD_BOOTD)
 		/* avoid "bootd" recursion */
 		if (cmdtp->cmd == do_bootd) {
 #ifdef DEBUG_PARSER
@@ -279,7 +279,7 @@
 				flag |= CMD_FLAG_BOOTD;
 			}
 		}
-#endif	/* CFG_CMD_BOOTD */
+#endif	/* CONFIG_CMD_BOOTD */
 
 		/* OK - call function to do the command */
 		if ((cmdtp->cmd) (cmdtp, argc, argv) != 0)
#1 lore raw

PATCH 1/1 U-Boot-V2: parser.c sparse cleanup

Quoted 19 lines · Nishanth

This patch cleans up the parser error seen during simple parser compilation.
Please note that CFG_CMD_BOOTD is not defined at the moment, but leaving it for addition at a later point of time.

Index: u-boot-v2.git/common/parser.c
===================================================================

common/parser.c +1 -1
@@ -2,7 +2,7 @@
 #include <command.h>
 #include <environment.h>
 
-int parse_line (char *line, char *argv[])
+static int parse_line (char *line, char *argv[])
 {
 	int nargs = 0;
 

common/parser.c line 268

Quoted 5 lines
common/parser.c +1 -1
@@ -265,7 +265,7 @@
 			continue;
 		}
 
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
+#if defined(CONFIG_COMMANDS) & defined(CONFIG_CMD_BOOTD)

U-Boot v1 used to have a bitmask for enabled commands (CONFIG_COMMANDS) and each command was represented by one bit, hence the construct above. We don't have this anymore and I think that this recursion stop does not work as expected anymore anyway, so you can remove this completely.

Sascha

Signature · 4 lines
Pengutronix e.K. - Linux Solutions for Science and Industry
-----------------------------------------------------------
Kontakt-Informationen finden Sie im Header dieser Mail oder
auf der Webseite -> http://www.pengutronix.de/impressum/ <-
#2 lore raw

PATCH v2 1/1 U-Boot-V2: parser.c sparse cleanup

Sascha,

Quoted 7 lines

-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Monday, May 12, 2008 8:28 AM
To: Menon, Nishanth
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [Patch] U-Boot-V2: parser.c sparse cleanup

Quoted 7 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
+#if defined(CONFIG_COMMANDS) & defined(CONFIG_CMD_BOOTD)

U-Boot v1 used to have a bitmask for enabled commands (CONFIG_COMMANDS) and each command was represented by one bit, hence the construct above. We don't have this anymore and I think that this recursion stop does not work as expected anymore anyway, so you can remove this completely.

Rev 2 of the patch:

common/parser.c +1 -17
Index: u-boot-v2.git/common/parser.c
===================================================================
@@ -2,7 +2,7 @@
 #include <command.h>
 #include <environment.h>
 
-int parse_line (char *line, char *argv[])
+static int parse_line (char *line, char *argv[])
 {
 	int nargs = 0;
 
@@ -265,22 +265,6 @@
 			continue;
 		}
 
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
-		/* avoid "bootd" recursion */
-		if (cmdtp->cmd == do_bootd) {
-#ifdef DEBUG_PARSER
-			printf ("[%s]\n", finaltoken);
-#endif
-			if (flag & CMD_FLAG_BOOTD) {
-				puts ("'bootd' recursion detected\n");
-				rc = -1;
-				continue;
-			} else {
-				flag |= CMD_FLAG_BOOTD;
-			}
-		}
-#endif	/* CFG_CMD_BOOTD */
-
 		/* OK - call function to do the command */
 		if ((cmdtp->cmd) (cmdtp, argc, argv) != 0)
 			rc = -1;