Patchwork [U-Boot,v3,08/16] main: Use get/setenv_ulong()

login
register
mail settings
Submitter Simon Glass
Date Feb. 26, 2013, 4:11 p.m.
Message ID <1361895069-7343-9-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/223333/
State Deferred
Delegated to: Tom Rini
Headers show

Comments

Simon Glass - Feb. 26, 2013, 4:11 p.m.
These functions are now available, so use them to avoid extra code here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
---
Changes in v3: None
Changes in v2: None

 common/main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Patch

diff --git a/common/main.c b/common/main.c
index e2eb9ec..8987444 100644
--- a/common/main.c
+++ b/common/main.c
@@ -318,8 +318,6 @@  static void process_boot_delay(void)
 #ifdef CONFIG_BOOTCOUNT_LIMIT
 	unsigned long bootcount = 0;
 	unsigned long bootlimit = 0;
-	char *bcs;
-	char bcs_set[16];
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 #ifdef CONFIG_OF_CONTROL
 	char *env;
@@ -331,10 +329,8 @@  static void process_boot_delay(void)
 	bootcount = bootcount_load();
 	bootcount++;
 	bootcount_store (bootcount);
-	sprintf (bcs_set, "%lu", bootcount);
-	setenv ("bootcount", bcs_set);
-	bcs = getenv ("bootlimit");
-	bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0;
+	setenv_ulong("bootcount", bootcount);
+	bootlimit = getenv_ulong("bootlimit", 10, 0);
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 
 	s = getenv ("bootdelay");