Add getenv_ulong to return an environment var as a number
Subsystems (7)
cover 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 <[email protected]>.
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(-)
Signature · 1 line
1.7.3.1
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
This is not an uncommon operation in U-Boot, so let's put it in a common function.
--- common/cmd_nvedit.c | 7 +++++++ include/common.h | 12 ++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-)
common/cmd_nvedit.c +7 -0
@@ -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[])
include/common.h +12 -0
@@ -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 *);
Signature · 1 line
1.7.3.1
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
subject is "int" but implementation is "ulong"
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111013/4848fc55/attachment.pgp
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
Hi Mike,
Quoted 3 lines · Mike Frysinger
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
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
Quoted 5 lines · On Friday 14 October 2011 12:47:56 Simon Glass wrote:
Quoted 1 line · Mike Frysinger
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111014/7ece226f/attachment.pgp
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
Hi Mike,
Quoted 11 lines · Mike Frysinger
Quoted 5 lines · On Friday 14 October 2011 12:47:56 Simon Glass wrote:
Quoted 1 line · Mike Frysinger
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
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
Quoted 8 lines · On Friday 14 October 2011 13:42:07 Simon Glass wrote:
Quoted 7 lines · Mike Frysinger
Quoted 5 lines · On Friday 14 October 2011 12:47:56 Simon Glass wrote:
Quoted 1 line · Mike Frysinger
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?
Quoted 6 lines
Quoted 2 lines
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.
Quoted 6 lines
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111014/710ec37c/attachment.pgp
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
Hi Mike,
Quoted 12 lines · Mike Frysinger
Quoted 11 lines · On Friday 14 October 2011 13:42:07 Simon Glass wrote:
Quoted 9 lines · Mike Frysinger
Quoted 5 lines · On Friday 14 October 2011 12:47:56 Simon Glass wrote:
Quoted 1 line · Mike Frysinger
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.
Quoted 6 lines
Quoted 3 lines
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.
Quoted 6 lines
Quoted 6 lines
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:
Quoted 7 lines
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
PATCH 1/10 Add getenv_int() to read an integer from an environment variable
In reply to Simon GlassDear Simon Glass,
Quoted 3 lines · In message <[email protected]> you wrote:
include/common.h +0
-0
...
Quoted 9 lines
+/**
+ * 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)
+ * @paramdefault_valDefault value to return if the variable is not
+ * found
+ * @return the decoded value, ordefault_valif 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
Signature · 5 lines
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 at denx.de "Just Say No." - Nancy Reagan "No." - Ronald Reagan
PATCH 2/10 arm: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/arm/lib/board.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-)
arch/arm/lib/board.c +11 -25
@@ -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@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
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH 2/10 arm: Use getenv_ulong() in place of getenv(), strtoul
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/arm/lib/board.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 at denx.de "There's only one way to have a happy marriage and as soon as I learn what it is I'll get married again." - Clint Eastwood
PATCH 2/10 arm: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassDear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- 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
Signature · 9 lines
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 at 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.
PATCH 2/10 arm: Use getenv_ulong() in place of getenv(), strtoul
Hi Wolfgang,
Quoted 14 lines · Wolfgang Denk
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>---
?arch/arm/lib/board.c | ? 36 +++++++++++------------------------- ?1 files changed, 11 insertions(+), 25 deletions(-)Urgh...
This breaks almost all ARM boards like this:
Quoted 7 lines
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.
Quoted 3 lines
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
Quoted 16 lines
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 at 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.
PATCH 1/1 arch/arm/lib/board.c: fix build error
In reply to Simon GlassCommit 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.
--- arch/arm/lib/board.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/lib/board.c +3 -0
@@ -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;
Signature · 1 line
1.7.6.2
PATCH 1/1 arch/arm/lib/board.c: fix build error
Hi Wolfgang,
Quoted 9 lines · Wolfgang Denk
Commit dc8bbea "arm: Use
getenv_ulong()in place ofgetenv(), 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
Quoted 28 lines
Signed-off-by Wolfgang Denk <[email protected]>---
?arch/arm/lib/board.c | ? ?3 +++
?1 files changed, 3 insertions(+), 0 deletions(-)arch/arm/lib/board.c +0
-0@@ -441,6 +441,9 @@ void board_init_r(gd_t *id, ulong dest_addr) ?#if !defined(CONFIG_SYS_NO_FLASH) ? ? ? ?ulong flash_size;?#endif
arch/arm/lib/board.c +3
-0+#if defined(CONFIG_CMD_NET ) + ? ? ? char *s; +#endif ? ? ? ?gd = id;
--
1.7.6.2_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 1/1 arch/arm/lib/board.c: fix build error
In reply to Wolfgang DenkHello Wolfgang,
Quoted 11 lines · Wolfgang Denk
Commit dc8bbea "arm: Use
getenv_ulong()in place ofgetenv(), 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 <[email protected]>
posted a patch too, see your fix too late, sorry, so forget my patch:
for this.
Thanks for fixing.
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 3/10 avr32: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/avr32/lib/board.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
arch/avr32/lib/board.c +3 -13
@@ -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 ();
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH 3/10 avr32: Use getenv_ulong() in place of getenv(), strtoul
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/avr32/lib/board.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 at denx.de "Here's a fish hangs in the net like a poor man's right in the law. 'Twill hardly come out." - Shakespeare, Pericles, Act II, Scene 1
PATCH 4/10 blackfin: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/blackfin/lib/board.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
arch/blackfin/lib/board.c +2 -7
@@ -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 */
Signature · 1 line
1.7.3.1
PATCH 4/10 blackfin: Use getenv_ulong() in place of getenv(), strtoul
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111013/b7e218e3/attachment.pgp
Wolfgang Denk
AppliedPATCH 4/10 blackfin: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassDear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/blackfin/lib/board.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 7 lines
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 at denx.de
How many seconds are there in a year? If I tell you there are 3.155 x
10^7, you won't even try to remember it. On the other hand, who could
forget that, to within half a percent, pi seconds is a nanocentury.
-- Tom Duff, Bell LabsPATCH 5/10 m68k: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/m68k/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
arch/m68k/lib/board.c +8 -25
@@ -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@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) */
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH 5/10 m68k: Use getenv_ulong() in place of getenv(), strtoul
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/m68k/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 at denx.de The universe does not have laws - it has habits, and habits can be broken.
PATCH 6/10 microblaze: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/microblaze/lib/board.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/microblaze/lib/board.c +2 -4
@@ -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" );
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH 6/10 microblaze: Use getenv_ulong() in place of getenv(), strtoul
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/microblaze/lib/board.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 9 lines
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 at denx.de
This was an amazing creation using small squares of compressed
vegetable matter on which letters were made by means of small carbon
particles from a stylus, giving an effect similar to the traditional
word-processor screen. It seemed amazingly portable and I never once
saw him have to change the batteries.
- Terry Pratchett & Stephen Briggs, _The Discworld Companion_PATCH 7/10 mips: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/mips/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
arch/mips/lib/board.c +3 -11
@@ -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));
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH 7/10 mips: Use getenv_ulong() in place of getenv(), strtoul
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/mips/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 at denx.de
Any sufficiently advanced bug is indistinguishable from a feature.
- Rich KulawiecPATCH 8/10 powerpc: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/powerpc/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
arch/powerpc/lib/board.c +8 -25
@@ -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@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
Signature · 1 line
1.7.3.1
PATCH 8/10 powerpc: Use getenv_ulong() in place of getenv(), strtoul
Quoted 3 lines · 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 <[email protected]>
Nice patch series. Thanks.
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 at denx.de
Wolfgang Denk
AppliedPATCH 8/10 powerpc: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassDear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/powerpc/lib/board.c | 33 ++++++++------------------------- 1 files changed, 8 insertions(+), 25 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
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 at denx.de The universe is all a spin-off of the Big Bang.
PATCH 1/1 arch/powerpc/lib/board.c: fix build warning
In reply to Simon GlassCommit 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.
--- arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/lib/board.c +3 -2
@@ -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
Signature · 1 line
1.7.6.2
PATCH 1/1 arch/powerpc/lib/board.c: fix build warning
Hi Wolfgang,
Quoted 9 lines · Wolfgang Denk
Commit 1272592 "powerpc: Use
getenv_ulong()in place ofgetenv(), 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 <[email protected]>
I sent an alternative to this but they are roughly equivalent so:
Thanks for fixing this.
Regards,
Simon
Quoted 30 lines
---
?arch/powerpc/lib/board.c | ? ?5 +++--
?1 files changed, 3 insertions(+), 2 deletions(-)arch/powerpc/lib/board.c +0
-0@@ -623,10 +623,11 @@ void board_init_f (ulong bootflag)?*/
?voidboard_init_r(gd_t*id, ulongdest_addr)
?{
- ? ? ? char *s;
? ? ? ?bd_t *bd;
? ? ? ?ulongmalloc_start;arch/powerpc/lib/board.c +3
-1- +#if defined(CONFIG_SYS_FLASH_CHECKSUM ) || defined(CONFIG_CMD_NET ) + ? ? ? char *s; +#endif ?#ifndef
CONFIG_SYS_NO_FLASH
? ? ? ?ulongflash_size;
?#endif
--
1.7.6.2_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 1/1 arch/powerpc/lib/board.c: fix build warning
Hello Simon, Wolfgang,
Quoted 9 lines · Simon Glass
Hi Wolfgang,
Quoted 6 lines · Wolfgang Denk
Commit 1272592 "powerpc: Use
getenv_ulong()in place ofgetenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r':
board.c:626: warning: unused variable 's'
Quoted 7 lines
Quoted 3 lines
Fix it.
Signed-off-by Wolfgang Denk <[email protected]>I sent an alternative to this but they are roughly equivalent so:
Acked-by Simon Glass <[email protected]>
Same on arm, posted for this a patch.
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Wolfgang Denk
AppliedPATCH 1/1 arch/powerpc/lib/board.c: fix build warning
In reply to Wolfgang DenkDear Wolfgang Denk,
Quoted 6 lines · In message <[email protected]> you wrote:
Commit 1272592 "powerpc: Use
getenv_ulong()in place ofgetenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r':
board.c:626: warning: unused variable 's'
Quoted 6 lines
Fix it.
Signed-off-by Wolfgang Denk <[email protected]>--- arch/powerpc/lib/board.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
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 at denx.de Overflow on /dev/null, please empty the bit bucket.
PATCH 1/1 arch/powerpc/lib/board.c: fix build warning
Quoted 16 lines · Wolfgang Denk
Dear Wolfgang Denk,
Quoted 6 lines · In message <[email protected]> you wrote:
Commit 1272592 "powerpc: Use
getenv_ulong()in place ofgetenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r':
board.c:626: warning: unused variable 's'Quoted 6 lines
Fix it.
Signed-off-by Wolfgang Denk <[email protected]>---
arch/powerpc/lib/board.c| 5 +++--1 files changed, 3 insertions(+), 2 deletions(-)
Quoted 5 lines
Applied, thanks.
Best regards,
Wolfgang Denk
I'm still seeing this warning when building MPC8536DS_config
- k
PATCH 1/1 arch/powerpc/lib/board.c: fix build warning
Quoted 25 lines · Kumar Gala
Quoted 16 lines · Wolfgang Denk
Dear Wolfgang Denk,
Quoted 6 lines · In message <[email protected]> you wrote:
Commit 1272592 "powerpc: Use
getenv_ulong()in place ofgetenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r':
board.c:626: warning: unused variable 's'Quoted 6 lines
Fix it.
Signed-off-by Wolfgang Denk <[email protected]>---
arch/powerpc/lib/board.c| 5 +++--1 files changed, 3 insertions(+), 2 deletions(-)Quoted 5 lines
Applied, thanks.
Best regards,
Wolfgang Denk
Quoted 7 lines
I'm still seeing this warning when building
MPC8536DS_config- k
_______________________________________________
U-Boot mailing list
U-Boot at 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
PATCH 1/1 arch/powerpc/lib/board.c: fix build warning
Quoted 11 lines · On Fri, 4 Nov 2011 01:47:04 -0500 Kumar Gala <[email protected]> wrote:
Quoted 10 lines · Kumar Gala
Quoted 9 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:
Commit 1272592 "powerpc: Use
getenv_ulong()in place ofgetenv(), 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.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Signed-off-by Wolfgang Denk <[email protected]>---
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.
Quoted 3 lines
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
PATCH 1/1 arch/powerpc/lib/board.c: fix build warning
In reply to Kumar GalaQuoted 18 lines · On Friday 04 November 2011 02:47:04 Kumar Gala wrote:
Quoted 17 lines · Kumar Gala
Quoted 16 lines · Wolfgang Denk
Quoted 6 lines · Wolfgang Denk
Commit 1272592 "powerpc: Use
getenv_ulong()in place ofgetenv(), strtoul" instroduced a build warning for some PPC systems:
board.c: In function 'board_init_r':
board.c:626: warning: unused variable 's'Quoted 6 lines
Fix it.
Signed-off-by Wolfgang Denk <[email protected]>---
arch/powerpc/lib/board.c| 5 +++--1 files changed, 3 insertions(+), 2 deletions(-)Applied, thanks.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Best regards,
Wolfgang Denk
I'm still seeing this warning when building
MPC8536DS_configI think we need to revert this now.
so post a revert of a9f4fc3fe571cc99260b063ad0ff291d31bafed0
Quoted 1 line
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111104/867a2860/attachment.pgp
PATCH 1/1 powerpc: Revert "arch/powerpc/lib/board.c: fix build warning"
This reverts commit a9f4fc3fe571cc99260b063ad0ff291d31bafed0.
commit aab773a47a8f7f40b9d7c4877853b00d22fb1347 already fixed the issue.
--- arch/powerpc/lib/board.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
arch/powerpc/lib/board.c +1 -3
@@ -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
Signature · 1 line
1.7.7.2
PATCH 1/1 powerpc: Revert "arch/powerpc/lib/board.c: fix build warning"
Dear Kim Phillips,
Quoted 15 lines · In message <[email protected]> you wrote:
This reverts commit
a9f4fc3fe571cc99260b063ad0ff291d31bafed0.commit
aab773a47a8f7f40b9d7c4877853b00d22fb1347already fixed the issue.Signed-off-by Kim Phillips <[email protected]>--- arch/powerpc/lib/board.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)arch/powerpc/lib/board.c +0
-0
arch/powerpc/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 628
Quoted 7 lines
arch/powerpc/lib/board.c +1
-3@@ -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
Signature · 6 lines
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 at denx.de
The most difficult thing in the world is to know how to do a thing
and to watch someone else doing it wrong, without commenting.
-- T.H. WhitePATCH 1/1 powerpc: Revert "arch/powerpc/lib/board.c: fix build warning"
Quoted 15 lines · On Saturday 05 November 2011 05:33:38 Wolfgang Denk wrote:
Quoted 14 lines · Kim Phillips
This reverts commit
a9f4fc3fe571cc99260b063ad0ff291d31bafed0.commit
aab773a47a8f7f40b9d7c4877853b00d22fb1347already fixed the issue.arch/powerpc/lib/board.c +0
-0@@ -625,9 +625,7 @@ void board_init_r (gd_t *id, ulong dest_addr) {bd_t *bd;ulong malloc_start;
Quoted 7 lines
arch/powerpc/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 628
Quoted 4 lines
arch/powerpc/lib/board.c +1
-3-#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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111106/2b03b6fa/attachment.pgp
PATCH 1/1 powerpc: Revert "arch/powerpc/lib/board.c: fix build warning"
Dear Mike Frysinger,
Quoted 4 lines · In message <[email protected]> you wrote:
have you pushed out your master in a while ? i see your tree sitting at
fec79acc864bed049b6beae719ccbf2bbec5403awhich 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
Signature · 6 lines
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 at denx.de Is truth not truth for all? -- Natira, "For the World is Hollow and I have Touched the Sky", stardate 5476.4.
PATCH 9/10 sparc: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/sparc/lib/board.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
arch/sparc/lib/board.c +3 -10
@@ -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));
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH 9/10 sparc: Use getenv_ulong() in place of getenv(), strtoul
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/sparc/lib/board.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 at denx.de You're dead, Jim. -- McCoy, "Amok Time", stardate 3372.7
PATCH 10/10 x86: Use getenv_ulong() in place of getenv(), strtoul
In reply to Simon GlassThis changes the board code to use the new getenv_ulong() function.
--- arch/x86/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
arch/x86/lib/board.c +3 -11
@@ -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));
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH 10/10 x86: Use getenv_ulong() in place of getenv(), strtoul
Dear Simon Glass,
Quoted 6 lines · In message <[email protected]> you wrote:
This changes the board code to use the new
getenv_ulong()function.Signed-off-by Simon Glass <[email protected]>--- arch/x86/lib/board.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
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 at denx.de Successful and fortunate crime is called virtue. - Seneca
cover Add getenv_ulong to return an environment var as a number
In reply to Simon GlassDear Simon Glass,
Quoted 9 lines
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<[email protected]>.
Simon Glass (10):
Addgetenv_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
cover Add getenv_ulong to return an environment var as a number
Hi Reinhard,
Quoted 18 lines · Reinhard Meyer
Dear Simon Glass,
Quoted 11 lines
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<[email protected]>.
Simon Glass (10):
? Addgetenv_int()to read an integer from an environment variableJust 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 howgetenv_int()would work before relocation.
cover Add getenv_ulong to return an environment var as a number
Quoted 12 lines · On Friday 14 October 2011 10:31:12 Simon Glass wrote:
Quoted 11 lines · Reinhard Meyer
Quoted 10 lines
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<[email protected]>.
Simon Glass (10):
Addgetenv_int()to read an integer from an environment variable
Quoted 8 lines
Quoted 5 lines
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 howgetenv_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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111014/df45a9d7/attachment.pgp
cover Add getenv_ulong to return an environment var as a number
Dear Mike Frysinger,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 3 lines
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
Signature · 5 lines
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 at denx.de A wise person makes his own decisions, a weak one obeys public opinion. -- Chinese proverb
cover Add getenv_ulong to return an environment var as a number
Hi Wolfgang, Mike,
Quoted 4 lines · Wolfgang Denk
Dear Mike Frysinger,
Quoted 1 line · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
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
Quoted 16 lines
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 at denx.de A wise person makes his ?own ?decisions, ?a ?weak ?one ?obeys ?public opinion. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? -- Chinese proverb
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
cover Add getenv_ulong to return an environment var as a number
In reply to Simon GlassDear Simon Glass,
Quoted 5 lines · In message <CAPnjgZ1L_5wuenKG25COx+-xHr+ULU82-X1HCg_E2r9ut8dGPw@mail.gmail.com>…
Quoted 2 lines
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
Signature · 5 lines
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 at denx.de
There are bugs and then there are bugs. And then there are bugs.
- Karl Lehenbauercover Add getenv_ulong to return an environment var as a number
Quoted 6 lines · On Friday 14 October 2011 15:27:59 Wolfgang Denk wrote:
Quoted 4 lines · Simon Glass
Quoted 1 line
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.
Quoted 7 lines
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 togetenv().
should we have getenv_ulong() and getenv_ulong_r() then ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111014/6a238260/attachment.pgp
cover Add getenv_ulong to return an environment var as a number
Hi Mike,
Quoted 10 lines · Mike Frysinger
Quoted 9 lines · On Friday 14 October 2011 15:27:59 Wolfgang Denk wrote:
Quoted 4 lines · Simon Glass
Quoted 1 line
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.
Quoted 8 lines
Quoted 4 lines
It is NOT recommended to use this in general.
Please do NOT replace the use of
getenv_f()with (direct or indirect) calls togetenv().should we have
getenv_ulong()andgetenv_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