nds32: Use getenv_ulong() in place of getenv(), strtoul
authorMacpaul Lin <macpaul@andestech.com>
Mon, 24 Oct 2011 08:43:17 +0000 (16:43 +0800)
committerMacpaul Lin <macpaul@andestech.com>
Tue, 1 Nov 2011 04:47:17 +0000 (12:47 +0800)
This changes the board code to use the new getenv_ulong() function.

Signed-off-by: Macpaul Lin <macpaul@andestech.com>
arch/nds32/lib/board.c

index 1776a72..2fd0e93 100644 (file)
@@ -50,13 +50,7 @@ ulong monitor_flash_len;
 #endif
 static int init_baudrate(void)
 {
-       char tmp[64];   /* long enough for environment variables */
-       int i = getenv_f("baudrate", tmp, sizeof(tmp));
-
-       gd->bd->bi_baudrate = gd->baudrate = (i > 0)
-                       ? (int) simple_strtoul(tmp, NULL, 10)
-                       : CONFIG_BAUDRATE;
-
+       gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
        return 0;
 }
 
@@ -400,9 +394,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #endif
 
        /* Initialize from environment */
-       s = getenv("loadaddr");
-       if (s != NULL)
-               load_addr = simple_strtoul(s, NULL, 16);
+       load_addr = getenv_ulong("loadaddr", 16, load_addr);
 
 #if defined(CONFIG_CMD_NET)
        s = getenv("bootfile");