public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] Corrected LED name match finding avoiding extraneous Usage printouts
@ 2011-08-16  2:42 Joel A Fernandes
  2011-08-16  2:42 ` [U-Boot] [PATCH 2/7] BeagleBoard: fix LED 0/1 in driver Joel A Fernandes
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Joel A Fernandes @ 2011-08-16  2:42 UTC (permalink / raw)
  To: u-boot

From: Jason Kridner <jkridner@beagleboard.org>

Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
---
 common/cmd_led.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/cmd_led.c b/common/cmd_led.c
index c53195f..8b46848 100644
--- a/common/cmd_led.c
+++ b/common/cmd_led.c
@@ -83,7 +83,7 @@ int str_onoff (char *var)
 
 int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int state, i;
+	int state, i, match = 0;
 
 	/* Validate arguments */
 	if ((argc != 3)) {
@@ -98,6 +98,7 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	for (i = 0; led_commands[i].string; i++) {
 		if ((strcmp("all", argv[1]) == 0) ||
 		    (strcmp(led_commands[i].string, argv[1]) == 0)) {
+		    	match = 1;
 			if (led_commands[i].on) {
 				if (state) {
 					led_commands[i].on();
@@ -112,7 +113,7 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	}
 
 	/* If we ran out of matches, print Usage */
-	if (!led_commands[i].string && !(strcmp("all", argv[1]) == 0)) {
+	if (!match) {
 		return cmd_usage(cmdtp);
 	}
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-16 23:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16  2:42 [U-Boot] [PATCH 1/7] Corrected LED name match finding avoiding extraneous Usage printouts Joel A Fernandes
2011-08-16  2:42 ` [U-Boot] [PATCH 2/7] BeagleBoard: fix LED 0/1 in driver Joel A Fernandes
2011-08-16  2:42 ` [U-Boot] [PATCH 3/7] led: added cmd_led to Makefile Joel A Fernandes
2011-08-16  2:42 ` [U-Boot] [PATCH 4/7] led: correct off/on locations in structure Joel A Fernandes
2011-08-16  2:42 ` [U-Boot] [PATCH 5/7] led: Fixed setting of STATUS_LED_BIT1 when led_name is 'all' Joel A Fernandes
2011-08-16 11:14   ` Sergei Shtylyov
2011-08-16 23:40     ` Joel A Fernandes
2011-08-16  2:42 ` [U-Boot] [PATCH 6/7] OMAP3: Add function to get state of a GPIO output Joel A Fernandes
2011-08-16  2:42 ` [U-Boot] [PATCH 7/7] led: Remove state-saving of led for toggle functionality and add toggle option to led command Joel A Fernandes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox