[U-Boot] [PATCH 0/10] Add getenv_ulong to return an environment var as a number

Several places in U-Boot's board files can make use of a function like this, so this patch series creates the function, and changes the board files to use it.
As suggested by Mike Frysinger vapier@gentoo.org.
Simon Glass (10): Add getenv_int() to read an integer from an environment variable arm: Use getenv_ulong() in place of getenv(), strtoul avr32: Use getenv_ulong() in place of getenv(), strtoul blackfin: Use getenv_ulong() in place of getenv(), strtoul m68k: Use getenv_ulong() in place of getenv(), strtoul microblaze: Use getenv_ulong() in place of getenv(), strtoul mips: Use getenv_ulong() in place of getenv(), strtoul powerpc: Use getenv_ulong() in place of getenv(), strtoul sparc: Use getenv_ulong() in place of getenv(), strtoul x86: Use getenv_ulong() in place of getenv(), strtoul
arch/arm/lib/board.c | 36 +++++++++++------------------------- arch/avr32/lib/board.c | 16 +++------------- arch/blackfin/lib/board.c | 9 ++------- arch/m68k/lib/board.c | 33 ++++++++------------------------- arch/microblaze/lib/board.c | 6 ++---- arch/mips/lib/board.c | 14 +++----------- arch/powerpc/lib/board.c | 33 ++++++++------------------------- arch/sparc/lib/board.c | 13 +++---------- arch/x86/lib/board.c | 14 +++----------- common/cmd_nvedit.c | 7 +++++++ include/common.h | 12 ++++++++++++ 11 files changed, 62 insertions(+), 131 deletions(-)

This is not an uncommon operation in U-Boot, so let's put it in a common function.
Signed-off-by: Simon Glass sjg@chromium.org --- common/cmd_nvedit.c | 7 +++++++ include/common.h | 12 ++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 101bc49..337ae9a 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -540,6 +540,13 @@ int getenv_f(const char *name, char *buf, unsigned len) return -1; }
+ulong getenv_ulong(const char *name, int base, ulong default_val) +{ + const char *str = getenv(name); + + return str ? simple_strtoul(str, NULL, base) : default_val; +} + #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) diff --git a/include/common.h b/include/common.h index eb19a44..c2796e2 100644 --- a/include/common.h +++ b/include/common.h @@ -288,6 +288,18 @@ void env_relocate (void); int envmatch (uchar *, int); char *getenv (const char *); int getenv_f (const char *name, char *buf, unsigned len); + +/** + * Decode the value of an environment variable and return it. + * + * @param name Name of environemnt variable + * @param base Number base to use (normally 10, or 16 for hex) + * @param default_val Default value to return if the variable is not + * found + * @return the decoded value, or default_val if not found + */ +ulong getenv_ulong(const char *name, int base, ulong default_val); + int saveenv (void); #ifdef CONFIG_PPC /* ARM version to be fixed! */ int inline setenv (const char *, const char *);

subject is "int" but implementation is "ulong" -mike

Hi Mike,
On Thu, Oct 13, 2011 at 6:53 PM, Mike Frysinger vapier@gentoo.org wrote:
subject is "int" but implementation is "ulong" -mike
Yes - I wonder if I can just submit a V2 for that one patch with a new subject?
Regards, Simon

On Friday 14 October 2011 12:47:56 Simon Glass wrote:
On Thu, Oct 13, 2011 at 6:53 PM, Mike Frysinger wrote:
subject is "int" but implementation is "ulong"
Yes - I wonder if I can just submit a V2 for that one patch with a new subject?
that's fine (i do it all the time). although in the future, your v2 should probably have the reply-to field set to the v1 patch. -mike

Hi Mike,
On Fri, Oct 14, 2011 at 10:09 AM, Mike Frysinger vapier@gentoo.org wrote:
On Friday 14 October 2011 12:47:56 Simon Glass wrote:
On Thu, Oct 13, 2011 at 6:53 PM, Mike Frysinger wrote:
subject is "int" but implementation is "ulong"
Yes - I wonder if I can just submit a V2 for that one patch with a new subject?
that's fine (i do it all the time). although in the future, your v2 should probably have the reply-to field set to the v1 patch. -mike
OK I need to figure out how to do that with git send-email. I can see how to do it with a single email, but I suppose if I post a V2 then every email should be in reply to its corresponding V1, is that right?
BTW I also need some patchwork automation since a lot of the patches marked 'NEW' in there are not - 'pwclient update' is most of it I suppose, if it had an option to get my password back - no reply to this:
http://lists.ozlabs.org/pipermail/patchwork/2010-December/000347.html
Regards, Simon

On Friday 14 October 2011 13:42:07 Simon Glass wrote:
On Fri, Oct 14, 2011 at 10:09 AM, Mike Frysinger wrote:
On Friday 14 October 2011 12:47:56 Simon Glass wrote:
On Thu, Oct 13, 2011 at 6:53 PM, Mike Frysinger wrote:
subject is "int" but implementation is "ulong"
Yes - I wonder if I can just submit a V2 for that one patch with a new subject?
that's fine (i do it all the time). although in the future, your v2 should probably have the reply-to field set to the v1 patch.
OK I need to figure out how to do that with git send-email. I can see how to do it with a single email, but I suppose if I post a V2 then every email should be in reply to its corresponding V1, is that right?
if you send out a whole new patchseries, i don't think each sub patch should be a reply to the original. having it be a new tree by itself is fine.
BTW I also need some patchwork automation since a lot of the patches marked 'NEW' in there are not - 'pwclient update' is most of it I suppose, if it had an option to get my password back - no reply to this:
http://lists.ozlabs.org/pipermail/patchwork/2010-December/000347.html
i've only used the web interface so far. and this extension makes life a lot easier when you have to select a lot (but not all) of the patches in a query: https://chrome.google.com/webstore/detail/ldopaogbegnhconlboidfjcmidndkbeg -mike

Hi Mike,
On Fri, Oct 14, 2011 at 11:06 AM, Mike Frysinger vapier@gentoo.org wrote:
On Friday 14 October 2011 13:42:07 Simon Glass wrote:
On Fri, Oct 14, 2011 at 10:09 AM, Mike Frysinger wrote:
On Friday 14 October 2011 12:47:56 Simon Glass wrote:
On Thu, Oct 13, 2011 at 6:53 PM, Mike Frysinger wrote:
subject is "int" but implementation is "ulong"
Yes - I wonder if I can just submit a V2 for that one patch with a new subject?
that's fine (i do it all the time). although in the future, your v2 should probably have the reply-to field set to the v1 patch.
OK I need to figure out how to do that with git send-email. I can see how to do it with a single email, but I suppose if I post a V2 then every email should be in reply to its corresponding V1, is that right?
if you send out a whole new patchseries, i don't think each sub patch should be a reply to the original. having it be a new tree by itself is fine.
Oh ok.
BTW I also need some patchwork automation since a lot of the patches marked 'NEW' in there are not - 'pwclient update' is most of it I suppose, if it had an option to get my password back - no reply to this:
http://lists.ozlabs.org/pipermail/patchwork/2010-December/000347.html
i've only used the web interface so far. and this extension makes life a lot easier when you have to select a lot (but not all) of the patches in a query: https://chrome.google.com/webstore/detail/ldopaogbegnhconlboidfjcmidndkbeg -mike
I can bring up a list of patches but see no checkboxes. I suppose I need to be logged in :-(
Regards, Simon

Dear Simon Glass,
In message 1318552994-6653-2-git-send-email-sjg@chromium.org you wrote:
--- a/include/common.h +++ b/include/common.h
...
+/**
- Decode the value of an environment variable and return it.
- @param name Name of environemnt variable
- @param base Number base to use (normally 10, or 16 for hex)
- @param default_val Default value to return if the variable is not
found
- @return the decoded value, or default_val if not found
- */
Please don't add such documentation to common.h (especially not when it breaks the coding style for multiline comments).
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/arm/lib/board.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 1fe3751..c764844 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -118,16 +118,11 @@ void blue_led_off(void) __attribute__((weak, alias("__blue_led_off"))); #if defined(CONFIG_ARM_DCC) && !defined(CONFIG_BAUDRATE) #define CONFIG_BAUDRATE 115200 #endif + static int init_baudrate(void) { - char tmp[64]; /* long enough for environment variables */ - int i = getenv_f("baudrate", tmp, sizeof(tmp)); - - gd->baudrate = (i > 0) - ? (int) simple_strtoul(tmp, NULL, 10) - : CONFIG_BAUDRATE; - - return (0); + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); + return 0; }
static int display_banner(void) @@ -267,6 +262,9 @@ void board_init_f(ulong bootflag) init_fnc_t **init_fnc_ptr; gd_t *id; ulong addr, addr_sp; +#ifdef CONFIG_PRAM + ulong reg; +#endif
/* Pointer is writable since we allocated a register for it */ gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07); @@ -317,9 +315,7 @@ void board_init_f(ulong bootflag) /* * reserve protected RAM */ - i = getenv_r("pram", (char *)tmp, sizeof(tmp)); - reg = (i > 0) ? simple_strtoul((const char *)tmp, NULL, 10) : - CONFIG_PRAM; + reg = getenv_ulong("pram", 10, CONFIG_PRAM); addr -= (reg << 10); /* size is in kB */ debug("Reserving %ldk for protected RAM at %08lx\n", reg, addr); #endif /* CONFIG_PRAM */ @@ -441,7 +437,6 @@ static char *failed = "*** failed ***\n";
void board_init_r(gd_t *id, ulong dest_addr) { - char *s; ulong malloc_start; #if !defined(CONFIG_SYS_NO_FLASH) ulong flash_size; @@ -569,9 +564,7 @@ void board_init_r(gd_t *id, ulong dest_addr) #endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
/* 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"); if (s != NULL) @@ -604,18 +597,11 @@ void board_init_r(gd_t *id, ulong dest_addr) * taking into account the protected RAM at top of memory */ { - ulong pram; + ulong pram = 0; uchar memsz[32]; -#ifdef CONFIG_PRAM - char *s;
- s = getenv("pram"); - if (s != NULL) - pram = simple_strtoul(s, NULL, 10); - else - pram = CONFIG_PRAM; -#else - pram = 0; +#ifdef CONFIG_PRAM + pram = getenv_ulong("pram", 10, CONFIG_PRAM); #endif #ifdef CONFIG_LOGBUFFER #ifndef CONFIG_ALT_LB_ADDR

Dear Simon Glass,
In message 1318552994-6653-3-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/arm/lib/board.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Dear Simon Glass,
In message 1318552994-6653-3-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/arm/lib/board.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-)
Urgh...
This breaks almost all ARM boards like this:
Configuring for a320evb board... board.c: In function 'board_init_r': board.c:569: error: 's' undeclared (first use in this function) board.c:569: error: (Each undeclared identifier is reported only once board.c:569: error: for each function it appears in.) make[1]: *** [/work/wd/tmp-arm/arch/arm/lib/board.o] Error 1 make: *** [/work/wd/tmp-arm/arch/arm/lib/libarm.o] Error 2
Didn't you run MAKELL?
Best regards,
Wolfgang Denk

Hi Wolfgang,
On Sun, Oct 23, 2011 at 2:49 PM, Wolfgang Denk wd@denx.de wrote:
Dear Simon Glass,
In message 1318552994-6653-3-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/arm/lib/board.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-)
Urgh...
This breaks almost all ARM boards like this:
Configuring for a320evb board... board.c: In function 'board_init_r': board.c:569: error: 's' undeclared (first use in this function) board.c:569: error: (Each undeclared identifier is reported only once board.c:569: error: for each function it appears in.) make[1]: *** [/work/wd/tmp-arm/arch/arm/lib/board.o] Error 1 make: *** [/work/wd/tmp-arm/arch/arm/lib/libarm.o] Error 2
Sorry, I have sent a patch for this.
Didn't you run MAKELL?
No these pre-date my getting that running (with Mike's help) and I didn't think to go back to this series.
Regards, Simon
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de ADVISORY: There is an Extremely Small but Nonzero Chance That, Through a Process Know as "Tunneling," This Product May Spontaneously Disappear from Its Present Location and Reappear at Any Random Place in the Universe, Including Your Neighbor's Domicile. The Manufacturer Will Not Be Responsible for Any Damages or Inconvenience That May Result.

Commit dc8bbea "arm: Use getenv_ulong() in place of getenv(), strtoul" introduced a build error for all ARM boards with network support:
board.c: In function 'board_init_r': board.c:569: error: 's' undeclared (first use in this function) board.c:569: error: (Each undeclared identifier is reported only once board.c:569: error: for each function it appears in.)
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de --- arch/arm/lib/board.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index c764844..367cf6b 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -441,6 +441,9 @@ void board_init_r(gd_t *id, ulong dest_addr) #if !defined(CONFIG_SYS_NO_FLASH) ulong flash_size; #endif +#if defined(CONFIG_CMD_NET) + char *s; +#endif
gd = id;

Hi Wolfgang,
On Sun, Oct 23, 2011 at 2:51 PM, Wolfgang Denk wd@denx.de wrote:
Commit dc8bbea "arm: Use getenv_ulong() in place of getenv(), strtoul" introduced a build error for all ARM boards with network support:
board.c: In function 'board_init_r': board.c:569: error: 's' undeclared (first use in this function) board.c:569: error: (Each undeclared identifier is reported only once board.c:569: error: for each function it appears in.)
Fix it.
This might fix all boards if they have both net and flash, or neither. But I sent a patch which tries to handle the case where we have one but not the other.
(I suspect the PPC warning might be similar, but will wait until I have done a MAKEALL before commenting on that)
Regards, Simon
Signed-off-by: Wolfgang Denk wd@denx.de
arch/arm/lib/board.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index c764844..367cf6b 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -441,6 +441,9 @@ void board_init_r(gd_t *id, ulong dest_addr) #if !defined(CONFIG_SYS_NO_FLASH) ulong flash_size; #endif +#if defined(CONFIG_CMD_NET)
- char *s;
+#endif
gd = id;
-- 1.7.6.2
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hello Wolfgang,
Wolfgang Denk wrote:
Commit dc8bbea "arm: Use getenv_ulong() in place of getenv(), strtoul" introduced a build error for all ARM boards with network support:
board.c: In function 'board_init_r': board.c:569: error: 's' undeclared (first use in this function) board.c:569: error: (Each undeclared identifier is reported only once board.c:569: error: for each function it appears in.)
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
posted a patch too, see your fix too late, sorry, so forget my patch:
Acked-by: Heiko Schocher hs@denx.de
for this.
Thanks for fixing.
bye, Heiko

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/avr32/lib/board.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c index 3e1cc0d..63fe297 100644 --- a/arch/avr32/lib/board.c +++ b/arch/avr32/lib/board.c @@ -95,19 +95,10 @@ static inline void dma_alloc_init(void)
static int init_baudrate(void) { - char tmp[64]; - int i; - - i = getenv_f("baudrate", tmp, sizeof(tmp)); - if (i > 0) { - gd->baudrate = simple_strtoul(tmp, NULL, 10); - } else { - gd->baudrate = CONFIG_BAUDRATE; - } + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); return 0; }
- static int display_banner (void) { printf ("\n\n%s\n\n", version_string); @@ -319,9 +310,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) jumptable_init(); console_init_r();
- s = getenv("loadaddr"); - if (s) - load_addr = simple_strtoul(s, NULL, 16); + /* Initialize from environment */ + load_addr = getenv_ulong("loadaddr", 16, load_addr);
#ifdef CONFIG_BITBANGMII bb_miiphy_init();

Dear Simon Glass,
In message 1318552994-6653-4-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/avr32/lib/board.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/blackfin/lib/board.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c index bfdb586..a70473c 100644 --- a/arch/blackfin/lib/board.c +++ b/arch/blackfin/lib/board.c @@ -62,11 +62,7 @@ static int display_banner(void)
static int init_baudrate(void) { - char baudrate[15]; - int i = getenv_f("baudrate", baudrate, sizeof(baudrate)); - gd->bd->bi_baudrate = gd->baudrate = (i > 0) - ? simple_strtoul(baudrate, NULL, 10) - : CONFIG_BAUDRATE; + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); return 0; }
@@ -374,8 +370,7 @@ void board_init_r(gd_t * id, ulong dest_addr) #endif
/* Initialize from environment */ - if ((s = getenv("loadaddr")) != NULL) - load_addr = simple_strtoul(s, NULL, 16); + load_addr = getenv_ulong("loadaddr", 16, load_addr);
#if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */

Acked-by: Mike Frysinger vapier@gentoo.org -mike

Dear Simon Glass,
In message 1318552994-6653-5-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/blackfin/lib/board.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/m68k/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c index b9ccb64..259b71c 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -119,13 +119,8 @@ typedef int (init_fnc_t) (void);
static int init_baudrate (void) { - char tmp[64]; /* long enough for environment variables */ - int i = getenv_f("baudrate", tmp, sizeof (tmp)); - - gd->baudrate = (i > 0) - ? (int) simple_strtoul (tmp, NULL, 10) - : CONFIG_BAUDRATE; - return (0); + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); + return 0; }
/***********************************************************************/ @@ -221,9 +216,7 @@ board_init_f (ulong bootflag) gd_t *id; init_fnc_t **init_fnc_ptr; #ifdef CONFIG_PRAM - int i; ulong reg; - char tmp[64]; /* long enough for environment variables */ #endif
/* Pointer is writable since we allocated a register for it */ @@ -264,8 +257,7 @@ board_init_f (ulong bootflag) /* * reserve protected RAM */ - i = getenv_f("pram", tmp, sizeof (tmp)); - reg = (i > 0) ? simple_strtoul (tmp, NULL, 10) : CONFIG_PRAM; + reg = getenv_ulong("pram", 10, CONFIG_PRAM); addr -= (reg << 10); /* size is in kB */ debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr); #endif /* CONFIG_PRAM */ @@ -575,9 +567,7 @@ void board_init_r (gd_t *id, ulong dest_addr) /* Insert function pointers now that we have relocated the code */
/* Initialize from environment */ - if ((s = getenv ("loadaddr")) != NULL) { - load_addr = simple_strtoul (s, NULL, 16); - } + load_addr = getenv_ulong("loadaddr", 16, load_addr); #if defined(CONFIG_CMD_NET) if ((s = getenv ("bootfile")) != NULL) { copy_filename (BootFile, s, sizeof (BootFile)); @@ -648,18 +638,11 @@ void board_init_r (gd_t *id, ulong dest_addr) * taking into account the protected RAM at top of memory */ { - ulong pram; - char memsz[32]; -#ifdef CONFIG_PRAM - char *s; + ulong pram = 0; + uchar memsz[32];
- if ((s = getenv ("pram")) != NULL) { - pram = simple_strtoul (s, NULL, 10); - } else { - pram = CONFIG_PRAM; - } -#else - pram=0; +#ifdef CONFIG_PRAM + pram = getenv_ulong("pram", 10, CONFIG_PRAM); #endif #ifdef CONFIG_LOGBUFFER /* Also take the logbuffer into account (pram is in kB) */

Dear Simon Glass,
In message 1318552994-6653-6-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/m68k/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/microblaze/lib/board.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c index d97543b..c595cb9 100644 --- a/arch/microblaze/lib/board.c +++ b/arch/microblaze/lib/board.c @@ -160,10 +160,8 @@ void board_init (void) /* Initialize stdio devices */ stdio_init ();
- if ((s = getenv ("loadaddr")) != NULL) { - load_addr = simple_strtoul (s, NULL, 16); - } - + /* Initialize from environment */ + load_addr = getenv_ulong("loadaddr", 16, load_addr); #if defined(CONFIG_CMD_NET) /* IP Address */ bd->bi_ip_addr = getenv_IPaddr("ipaddr");

Dear Simon Glass,
In message 1318552994-6653-7-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/microblaze/lib/board.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/mips/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c index cc75d3f..1274d63 100644 --- a/arch/mips/lib/board.c +++ b/arch/mips/lib/board.c @@ -101,14 +101,8 @@ static void display_flash_config(ulong size)
static int init_baudrate (void) { - char tmp[64]; /* long enough for environment variables */ - int i = getenv_f("baudrate", tmp, sizeof (tmp)); - - gd->baudrate = (i > 0) - ? (int) simple_strtoul (tmp, NULL, 10) - : CONFIG_BAUDRATE; - - return (0); + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); + return 0; }
@@ -348,9 +342,7 @@ void board_init_r (gd_t *id, ulong dest_addr) /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
/* Initialize from environment */ - if ((s = getenv ("loadaddr")) != NULL) { - load_addr = simple_strtoul (s, NULL, 16); - } + load_addr = getenv_ulong("loadaddr", 16, load_addr); #if defined(CONFIG_CMD_NET) if ((s = getenv ("bootfile")) != NULL) { copy_filename (BootFile, s, sizeof (BootFile));

Dear Simon Glass,
In message 1318552994-6653-8-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/mips/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/powerpc/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 4fd0149..f7325c8 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -158,13 +158,8 @@ typedef int (init_fnc_t) (void);
static int init_baudrate (void) { - char tmp[64]; /* long enough for environment variables */ - int i = getenv_f("baudrate", tmp, sizeof (tmp)); - - gd->baudrate = (i > 0) - ? (int) simple_strtoul (tmp, NULL, 10) - : CONFIG_BAUDRATE; - return (0); + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); + return 0; }
/***********************************************************************/ @@ -374,9 +369,7 @@ void board_init_f (ulong bootflag) gd_t *id; init_fnc_t **init_fnc_ptr; #ifdef CONFIG_PRAM - int i; ulong reg; - uchar tmp[64]; /* long enough for environment variables */ #endif
/* Pointer is writable since we allocated a register for it */ @@ -448,10 +441,9 @@ void board_init_f (ulong bootflag) /* * reserve protected RAM */ - i = getenv_f("pram", (char *)tmp, sizeof (tmp)); - reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM; + reg = getenv_ulong("pram", 10, CONFIG_PRAM); addr -= (reg << 10); /* size is in kB */ - debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr); + debug("Reserving %ldk for protected RAM at %08lx\n", reg, addr); #endif /* CONFIG_PRAM */
/* round down to next 4 kB limit */ @@ -933,9 +925,7 @@ void board_init_r (gd_t *id, ulong dest_addr) udelay (20);
/* Initialize from environment */ - if ((s = getenv ("loadaddr")) != NULL) { - load_addr = simple_strtoul (s, NULL, 16); - } + load_addr = getenv_ulong("loadaddr", 16, load_addr); #if defined(CONFIG_CMD_NET) if ((s = getenv ("bootfile")) != NULL) { copy_filename (BootFile, s, sizeof (BootFile)); @@ -1018,18 +1008,11 @@ void board_init_r (gd_t *id, ulong dest_addr) * taking into account the protected RAM at top of memory */ { - ulong pram; + ulong pram = 0; uchar memsz[32]; -#ifdef CONFIG_PRAM - char *s;
- if ((s = getenv ("pram")) != NULL) { - pram = simple_strtoul (s, NULL, 10); - } else { - pram = CONFIG_PRAM; - } -#else - pram=0; +#ifdef CONFIG_PRAM + pram = getenv_ulong("pram", 10, CONFIG_PRAM); #endif #ifdef CONFIG_LOGBUFFER #ifndef CONFIG_ALT_LB_ADDR

On Friday 14 October 2011 02:43:12 Simon Glass wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
Nice patch series. Thanks.
Acked-by: Stefan Roese sr@denx.de
Cheers, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

Dear Simon Glass,
In message 1318552994-6653-9-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/powerpc/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de --- arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 6cb0ed6..aff1a0c 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -623,10 +623,11 @@ void board_init_f (ulong bootflag) */ void board_init_r (gd_t *id, ulong dest_addr) { - char *s; bd_t *bd; ulong malloc_start; - +#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET) + char *s; +#endif #ifndef CONFIG_SYS_NO_FLASH ulong flash_size; #endif

Hi Wolfgang,
On Sun, Oct 23, 2011 at 2:58 PM, Wolfgang Denk wd@denx.de wrote:
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
I sent an alternative to this but they are roughly equivalent so:
Acked-by: Simon Glass sjg@chromium.org
Thanks for fixing this.
Regards, Simon
arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 6cb0ed6..aff1a0c 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -623,10 +623,11 @@ void board_init_f (ulong bootflag) */ void board_init_r (gd_t *id, ulong dest_addr) {
- char *s;
bd_t *bd; ulong malloc_start;
+#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET)
- char *s;
+#endif #ifndef CONFIG_SYS_NO_FLASH ulong flash_size; #endif -- 1.7.6.2
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hello Simon, Wolfgang,
Simon Glass wrote:
Hi Wolfgang,
On Sun, Oct 23, 2011 at 2:58 PM, Wolfgang Denk wd@denx.de wrote:
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
I sent an alternative to this but they are roughly equivalent so:
Acked-by: Simon Glass sjg@chromium.org
Same on arm, posted for this a patch.
Acked-by: Heiko Schocher hs@denx.de
bye, Heiko

Dear Wolfgang Denk,
In message 1319407132-6590-1-git-send-email-wd@denx.de you wrote:
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:
Dear Wolfgang Denk,
In message 1319407132-6590-1-git-send-email-wd@denx.de you wrote:
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
I'm still seeing this warning when building MPC8536DS_config
- k

On Nov 4, 2011, at 1:44 AM, Kumar Gala wrote:
On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:
Dear Wolfgang Denk,
In message 1319407132-6590-1-git-send-email-wd@denx.de you wrote:
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
I'm still seeing this warning when building MPC8536DS_config
- k
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
I think we need to revert this now.
I don't see why you'd need it.
- k

On Fri, 4 Nov 2011 01:47:04 -0500 Kumar Gala galak@kernel.crashing.org wrote:
On Nov 4, 2011, at 1:44 AM, Kumar Gala wrote:
On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:
In message 1319407132-6590-1-git-send-email-wd@denx.de you wrote:
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
I'm still seeing this warning when building MPC8536DS_config
me too, on most 83xx boards.
I think we need to revert this now.
I don't see why you'd need it.
yes, all code fragments that utilize a variable 's' declare one local to their code body.
Kim

On Friday 04 November 2011 02:47:04 Kumar Gala wrote:
On Nov 4, 2011, at 1:44 AM, Kumar Gala wrote:
On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:
Wolfgang Denk wrote:
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r': board.c:626: warning: unused variable 's'
Fix it.
Signed-off-by: Wolfgang Denk wd@denx.de
arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
I'm still seeing this warning when building MPC8536DS_config
I think we need to revert this now.
so post a revert of a9f4fc3fe571cc99260b063ad0ff291d31bafed0
I don't see why you'd need it.
Wolfgang's patch was written before Simon's, but they both ended up getting merged when we only needed one of them ... -mike

This reverts commit a9f4fc3fe571cc99260b063ad0ff291d31bafed0.
commit aab773a47a8f7f40b9d7c4877853b00d22fb1347 already fixed the issue.
Signed-off-by: Kim Phillips kim.phillips@freescale.com --- arch/powerpc/lib/board.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 3a1b375..508075f 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -625,9 +625,7 @@ void board_init_r (gd_t *id, ulong dest_addr) { bd_t *bd; ulong malloc_start; -#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET) - char *s; -#endif + #ifndef CONFIG_SYS_NO_FLASH ulong flash_size; #endif

Dear Kim Phillips,
In message 20111104163427.db13a668c89386e254098062@freescale.com you wrote:
This reverts commit a9f4fc3fe571cc99260b063ad0ff291d31bafed0.
commit aab773a47a8f7f40b9d7c4877853b00d22fb1347 already fixed the issue.
Signed-off-by: Kim Phillips kim.phillips@freescale.com
arch/powerpc/lib/board.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 3a1b375..508075f 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -625,9 +625,7 @@ void board_init_r (gd_t *id, ulong dest_addr) { bd_t *bd; ulong malloc_start; -#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET)
- char *s;
-#endif
Which tree / version is your patch based on? It does not apply to master. We fixed this with commit commit ecfd752.
Best regards,
Wolfgang Denk

On Saturday 05 November 2011 05:33:38 Wolfgang Denk wrote:
Kim Phillips wrote:
This reverts commit a9f4fc3fe571cc99260b063ad0ff291d31bafed0.
commit aab773a47a8f7f40b9d7c4877853b00d22fb1347 already fixed the issue.
--- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -625,9 +625,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
{
bd_t *bd; ulong malloc_start;
-#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET)
- char *s;
-#endif
Which tree / version is your patch based on? It does not apply to master. We fixed this with commit commit ecfd752.
have you pushed out your master in a while ? i see your tree sitting at fec79acc864bed049b6beae719ccbf2bbec5403a which still has this warning. i also don't see commit ecfd752 in your tree. -mike

Dear Mike Frysinger,
In message 201111061306.37421.vapier@gentoo.org you wrote:
have you pushed out your master in a while ? i see your tree sitting at fec79acc864bed049b6beae719ccbf2bbec5403a which still has this warning. i also don't see commit ecfd752 in your tree.
master is in sync. But you are right - ecfd752 is in my GCC 4.6 cleanup branch.
I will wait another day for feedback on these and then pull them.
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/sparc/lib/board.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c index af4f035..69b5ca4 100644 --- a/arch/sparc/lib/board.c +++ b/arch/sparc/lib/board.c @@ -87,13 +87,8 @@ ulong monitor_flash_len;
static int init_baudrate(void) { - char tmp[64]; /* long enough for environment variables */ - int i = getenv_f("baudrate", tmp, sizeof(tmp)); - - gd->baudrate = (i > 0) - ? (int)simple_strtoul(tmp, NULL, 10) - : CONFIG_BAUDRATE; - return (0); + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); + return 0; }
/***********************************************************************/ @@ -366,9 +361,7 @@ void board_init_f(ulong bootflag) udelay(20);
/* Initialize from environment */ - if ((s = getenv("loadaddr")) != NULL) { - load_addr = simple_strtoul(s, NULL, 16); - } + load_addr = getenv_ulong("loadaddr", 16, load_addr); #if defined(CONFIG_CMD_NET) if ((s = getenv("bootfile")) != NULL) { copy_filename(BootFile, s, sizeof(BootFile));

Dear Simon Glass,
In message 1318552994-6653-10-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/sparc/lib/board.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index 2309e00..8963580 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -74,14 +74,8 @@ extern ulong __bss_end; */ static int init_baudrate (void) { - char tmp[64]; /* long enough for environment variables */ - int i = getenv_f("baudrate", tmp, 64); - - gd->baudrate = (i != 0) - ? (int) simple_strtoul (tmp, NULL, 10) - : CONFIG_BAUDRATE; - - return (0); + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); + return 0; }
static int display_banner (void) @@ -360,9 +354,7 @@ void board_init_r(gd_t *id, ulong dest_addr) udelay(20);
/* Initialize from environment */ - if ((s = getenv ("loadaddr")) != NULL) { - load_addr = simple_strtoul (s, NULL, 16); - } + load_addr = getenv_ulong("loadaddr", 16, load_addr); #if defined(CONFIG_CMD_NET) if ((s = getenv ("bootfile")) != NULL) { copy_filename (BootFile, s, sizeof (BootFile));

Dear Simon Glass,
In message 1318552994-6653-11-git-send-email-sjg@chromium.org you wrote:
This changes the board code to use the new getenv_ulong() function.
Signed-off-by: Simon Glass sjg@chromium.org
arch/x86/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Dear Simon Glass,
Several places in U-Boot's board files can make use of a function like this, so this patch series creates the function, and changes the board files to use it.
As suggested by Mike Frysingervapier@gentoo.org.
Simon Glass (10): Add getenv_int() to read an integer from an environment variable
Just a question (I cannot dig deep into this):
Since getenv_* might be used before relocation (it is for baudrate, am I right?), and I cannot see how getenv_int() would work before relocation.
And why do you mention getenv_int but implement getenv_long?
Best Regards, Reinhard

Hi Reinhard,
On Thu, Oct 13, 2011 at 11:13 PM, Reinhard Meyer u-boot@emk-elektronik.de wrote:
Dear Simon Glass,
Several places in U-Boot's board files can make use of a function like this, so this patch series creates the function, and changes the board files to use it.
As suggested by Mike Frysingervapier@gentoo.org.
Simon Glass (10): Add getenv_int() to read an integer from an environment variable
Just a question (I cannot dig deep into this):
Since getenv_* might be used before relocation (it is for baudrate, am I right?), and I cannot see how getenv_int() would work before relocation.
From what I can tell the existing getenv() function deals with this
automatically by looking at the global flags.
And why do you mention getenv_int but implement getenv_long?
This is a mistake, sorry.
Regards, Simon
Best Regards, Reinhard

On Friday 14 October 2011 10:31:12 Simon Glass wrote:
On Thu, Oct 13, 2011 at 11:13 PM, Reinhard Meyer wrote:
Several places in U-Boot's board files can make use of a function like this, so this patch series creates the function, and changes the board files to use it.
As suggested by Mike Frysingervapier@gentoo.org.
Simon Glass (10): Add getenv_int() to read an integer from an environment variable
Just a question (I cannot dig deep into this):
Since getenv_* might be used before relocation (it is for baudrate, am I right?), and I cannot see how getenv_int() would work before relocation.
From what I can tell the existing getenv() function deals with this automatically by looking at the global flags.
yep, and that should be sufficient. in the pre-relocation stages, you can only have one active getenv() at a time, but that isn't anything new, and in this particular case, it's fine.
if people need an explicit getenv_ulong_r() in the future, we can wait for someone else to propose that. but i think it unlikely. -mike

Dear Mike Frysinger,
In message 201110141311.55171.vapier@gentoo.org you wrote:
From what I can tell the existing getenv() function deals with this automatically by looking at the global flags.
yep, and that should be sufficient. in the pre-relocation stages, you can only have one active getenv() at a time, but that isn't anything new, and in this particular case, it's fine.
No, it's not. I NAK this.
Best regards,
Wolfgang Denk

Hi Wolfgang, Mike,
On Fri, Oct 14, 2011 at 12:30 PM, Wolfgang Denk wd@denx.de wrote:
Dear Mike Frysinger,
In message 201110141311.55171.vapier@gentoo.org you wrote:
From what I can tell the existing getenv() function deals with this automatically by looking at the global flags.
yep, and that should be sufficient. in the pre-relocation stages, you can only have one active getenv() at a time, but that isn't anything new, and in this particular case, it's fine.
No, it's not. I NAK this.
OK I am sending a v3 patch that checks for this and does the right thing. Maybe that will help.
Regards, Simon
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de A wise person makes his own decisions, a weak one obeys public opinion. -- Chinese proverb _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Dear Simon Glass,
In message CAPnjgZ1L_5wuenKG25COx+-xHr+ULU82-X1HCg_E2r9ut8dGPw@mail.gmail.com you wrote:
and I cannot see how getenv_int() would work before relocation.
From what I can tell the existing getenv() function deals with this automatically by looking at the global flags.
This is intended just for emergency cases to fix a number of places where code is broken, and maintainers don't bother to fix their code.
It is NOT recommended to use this in general.
Please do NOT replace the use of getenv_f() with (direct or indirect) calls to getenv().
Best regards,
Wolfgang Denk

On Friday 14 October 2011 15:27:59 Wolfgang Denk wrote:
Simon Glass wrote:
and I cannot see how getenv_int() would work before relocation.
From what I can tell the existing getenv() function deals with this automatically by looking at the global flags.
This is intended just for emergency cases to fix a number of places where code is broken, and maintainers don't bother to fix their code.
It is NOT recommended to use this in general.
Please do NOT replace the use of getenv_f() with (direct or indirect) calls to getenv().
should we have getenv_ulong() and getenv_ulong_r() then ? -mike

Hi Mike,
On Fri, Oct 14, 2011 at 2:33 PM, Mike Frysinger vapier@gentoo.org wrote:
On Friday 14 October 2011 15:27:59 Wolfgang Denk wrote:
Simon Glass wrote:
and I cannot see how getenv_int() would work before relocation.
From what I can tell the existing getenv() function deals with this automatically by looking at the global flags.
This is intended just for emergency cases to fix a number of places where code is broken, and maintainers don't bother to fix their code.
It is NOT recommended to use this in general.
Please do NOT replace the use of getenv_f() with (direct or indirect) calls to getenv().
should we have getenv_ulong() and getenv_ulong_r() then ? -mike
Since there is a flag to tell you, I don't think so - but anyway we are back to v2, so let's see how that goes.
Regards, Simon
participants (8)
-
Heiko Schocher
-
Kim Phillips
-
Kumar Gala
-
Mike Frysinger
-
Reinhard Meyer
-
Simon Glass
-
Stefan Roese
-
Wolfgang Denk