misc fixes / cleanups
cover misc fixes / cleanups
The following set of patches performs a number of pretty localized, simple fixes and cleanups:
1/6 boards.cfg: fix board directory name for ML2 board 2/6 shannon/INFERNO: fix special handling of environment configuration 3/6 cmd_ide.c: fix unused variable warning for SC3 board 4/6 exports.c: fix warning: 'dummy' defined but not used 5/6 Make *printf() return "int" instead of "void" 6/6 Redundant environment: move flag definitions to header file
PATCH 1/6 boards.cfg: fix board directory name for ML2 board
--- boards.cfg | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
boards.cfg +1 -1
@@ -180,7 +180,7 @@ G2000 powerpc ppc4xx g2000 JSE powerpc ppc4xx jse korat powerpc ppc4xx lwmon5 powerpc ppc4xx -ML2 powerpc ppc4xx +ML2 powerpc ppc4xx ml2 sbc405 powerpc ppc4xx sc3 powerpc ppc4xx zeus powerpc ppc4xx
Signature · 1 line
1.7.0.1
PATCH 2/6 shannon/INFERNO: fix special handling of environment configuration
In reply to Wolfgang DenkRemove some INFERNO related #ifdef's from common environment code by fixing the board configuration settings (add CONFIG_ENV_SECT_SIZE).
While we are at it, fix comment which incorrectly talks about 4 KB environment size, while it's actually 0x4000 = 16 KiB.
--- common/env_flash.c | 12 ------------ common/env_nand.c | 4 ---- include/configs/shannon.h | 7 ++++--- 3 files changed, 4 insertions(+), 19 deletions(-)
common/env_flash.c +0 -12
@@ -44,12 +44,6 @@ DECLARE_GLOBAL_DATA_PTR;#error CONFIG_ENV_SIZE_REDUND should not be less then CONFIG_ENV_SIZE#endif -#ifdef CONFIG_INFERNO -# ifdef CONFIG_ENV_ADDR_REDUND -#error CONFIG_ENV_ADDR_REDUND is not implemented for CONFIG_INFERNO -# endif -#endif -char * env_name_spec ="Flash" ;#ifdef ENV_IS_EMBEDDED
@@ -294,13 +288,7 @@ int saveenv(void) len =CONFIG_ENV_SIZE ;#endif /* CONFIG_ENV_SECT_SIZE */ -#ifndef CONFIG_INFERNO end_addr = flash_sect_addr + len -1 ; -#else -/* this is the last sector, and the size is hardcoded here */ -/* otherwise we will get stack problems on loading 128 KB environment */ - end_addr = flash_sect_addr +0x20000 -1 ; -#endif debug ("Protect off %08lX ... %08lX\n" , (ulong )flash_sect_addr, end_addr);
common/env_nand.c +0 -4
@@ -49,10 +49,6 @@#error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE#endif -#ifdef CONFIG_INFERNO -#error CONFIG_INFERNO not supported yet -#endif -#ifndef CONFIG_ENV_RANGE #define CONFIG_ENV_RANGE CONFIG_ENV_SIZE#endif
include/configs/shannon.h +4 -3
@@ -161,12 +161,13 @@#define CONFIG_ENV_IS_IN_FLASH 1#ifdef CONFIG_INFERNO -/* we take the last sector, 128 KB in size, but we only use 4 KB of it for stack reasons */ +/* we take the last sector, 128 KB in size, but we only use 16 KB of it for stack reasons */ #define CONFIG_ENV_ADDR (PHYS_FLASH_1 + 0x003E0000)/* Addr of Environment Sector */ -#define CONFIG_ENV_SIZE 0x4000/* Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000/* Total Size of Environment */ +#define CONFIG_ENV_SECT_SIZE (128 << 10)/* size of environment sector */ #else #define CONFIG_ENV_ADDR (PHYS_FLASH_1 + 0x1C000)/* Addr of Environment Sector */ -#define CONFIG_ENV_SIZE 0x4000/* Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000/* Total Size of Environment */ #endif /*-----------------------------------------------------------------------
Signature · 1 line
1.7.0.1
Wolfgang Denk
AppliedPATCH 2/6 shannon/INFERNO: fix special handling of environment configuration
Quoted 6 lines · In message <[email protected]> you wrote:
Remove some INFERNO related #ifdef's from common environment code by fixing the board configuration settings (add
CONFIG_ENV_SECT_SIZE).While we are at it, fix comment which incorrectly talks about 4 KB environment size, while it's actually
0x4000= 16 KiB.
Quoted 7 lines
Signed-off-by Wolfgang Denk <[email protected]>Cc Rolf Offermanns <[email protected]>--- common/env_flash.c | 12 ------------ common/env_nand.c | 4 ---- include/configs/shannon.h | 7 ++++--- 3 files changed, 4 insertions(+), 19 deletions(-)
Applied.
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 Mistakes are often the stepping stones to utter failure.
PATCH 3/6 cmd_ide.c: fix unused variable warning for SC3 board
In reply to Wolfgang Denk--- common/cmd_ide.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
common/cmd_ide.c +0 -1
@@ -555,7 +555,6 @@ void ide_init (void)int i, bus;#if defined(CONFIG_SC3 )unsigned int ata_reset_time =ATA_RESET_TIME ; -char *s;#endif #ifdef CONFIG_IDE_8xx_PCCARDextern int pcmcia_on (void );
Signature · 1 line
1.7.0.1
Wolfgang Denk
AppliedPATCH 3/6 cmd_ide.c: fix unused variable warning for SC3 board
Quoted 4 lines · In message <[email protected]> you wrote:
Signed-off-by Wolfgang Denk <[email protected]>--- common/cmd_ide.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
Applied.
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 I had the rare misfortune of being one of the first people to try and implement a PL/1 compiler. -- T. Cheatham
PATCH 4/6 exports.c: fix warning: 'dummy' defined but not used
In reply to Wolfgang Denk--- common/exports.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
common/exports.c +4 -0
@@ -3,9 +3,13 @@DECLARE_GLOBAL_DATA_PTR ; +#if (!defined(CONFIG_I386 ) && !defined(CONFIG_PPC )) || \ + !defined(CONFIG_CMD_I2C ) || \ + !defined(CONFIG_CMD_SPI )static void dummy (void ) { } +#endif unsigned long get_version (void ) {
Signature · 1 line
1.7.0.1
PATCH 4/6 exports.c: fix warning: 'dummy' defined but not used
common/exports.c line 12
Quoted 13 lines · On Wednesday, June 23, 2010 18:06:11 Wolfgang Denk wrote:
common/exports.c +4
-0@@ -3,9 +3,13 @@DECLARE_GLOBAL_DATA_PTR ; +#if (!defined(CONFIG_I386 ) && !defined(CONFIG_PPC )) || \ + !defined(CONFIG_CMD_I2C ) || \ + !defined(CONFIG_CMD_SPI )static void dummy (void ) { } +#endif
would __attribute__((unused)) be better ? then we'd avoid the #ifdef mess. -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/20100623/4c8bc425/attachment.pgp
PATCH v2 4/6 exports.c: fix warning: 'dummy' defined but not used
In reply to Wolfgang Denk---
v2: fix compile problem for some boards.
common/exports.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
common/exports.c +5 -0
@@ -3,9 +3,14 @@DECLARE_GLOBAL_DATA_PTR ; +#if (!defined(CONFIG_I386 ) && !defined(CONFIG_PPC )) || \ + !defined(CONFIG_CMD_I2C ) || \ + !defined(CONFIG_HAS_UID ) || \ + !defined(CONFIG_CMD_SPI )static void dummy (void ) { } +#endif unsigned long get_version (void ) {
Signature · 1 line
1.7.0.1
PATCH v2 4/6 exports.c: fix warning: 'dummy' defined but not used
Quoted 3 lines · On Tuesday, June 29, 2010 05:52:32 Wolfgang Denk wrote:
Signed-off-by Wolfgang Denk <[email protected]>---
v2: fix compile problem for some boards.
an attribute should fix all compile errors since the func never gets hidden ;) -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/20100629/96686773/attachment.pgp
PATCH v2 4/6 exports.c: fix warning: 'dummy' defined but not used
Dear Mike Frysinger,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 3 lines · On Tuesday, June 29, 2010 05:52:32 Wolfgang Denk wrote:
Signed-off-by Wolfgang Denk <[email protected]>---
v2: fix compile problem for some boards.an attribute should fix all compile errors since the func never gets hidden ;)
Yes, I read your first message too, just too late. Thanks!
Will respin that patch.
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 When the tide of life turns against you And the current upsets your boat Don't waste tears on what might have been Just lie on your back and float.
PATCH v3 4/6 exports.c: fix warning: 'dummy' defined but not used
In reply to Wolfgang DenkAlso get rid of the #ifdef's while doing this.
---
v2: fix compile problem for some boards.
v3: get rid of #ifdef mess and use attribute instead as suggested
by Mike Frysinger
common/exports.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
common/exports.c +1 -0
@@ -3,6 +3,7 @@DECLARE_GLOBAL_DATA_PTR ; +static void dummy (void ) __attribute__((unused));static void dummy (void ) { }
Signature · 1 line
1.7.0.1
PATCH v3 4/6 exports.c: fix warning: 'dummy' defined but not used
Quoted 4 lines · On Wednesday, June 30, 2010 18:44:46 Wolfgang Denk wrote:
+static void dummy(void) __attribute__((unused));
static void dummy(void)
{
}
put the attribute before the "static" and you shouldnt need the duplicate prototype
-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/20100630/2e59ecba/attachment.pgp
PATCH v3 4/6 exports.c: fix warning: 'dummy' defined but not used
Dear Mike Frysinger,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines
+static void dummy(void) __attribute__((unused));
static void dummy(void)
{
}put the attribute before the "static" and you shouldnt need the duplicate prototype
Ah, that's the trick that does it.
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 Use C++ to confuse your enemies; use C to produce stable code.
PATCH v4 4/6 exports.c: fix warning: 'dummy' defined but not used
In reply to Wolfgang DenkAlso get rid of the #ifdef's while doing this.
---
v2: fix compile problem for some boards.
v3: get rid of #ifdef mess and use attribute instead as suggested
by Mike Frysinger
v4: Avoid separate prototype declaration.
common/exports.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/exports.c +1 -1
@@ -3,7 +3,7 @@DECLARE_GLOBAL_DATA_PTR ; -static void dummy (void ) +__attribute__((unused))static void dummy (void ) { }
Signature · 1 line
1.7.0.1
Wolfgang Denk
AppliedPATCH v4 4/6 exports.c: fix warning: 'dummy' defined but not used
Quoted 4 lines · In message <[email protected]> you wrote:
Also get rid of the #ifdef's while doing this.
Suggested-by Mike Frysinger <[email protected]>Signed-off-by Wolfgang Denk <[email protected]>
Quoted 8 lines
---
v2: fix compile problem for some boards.
v3: get rid of #ifdef mess and use attribute instead as suggested
by Mike Frysinger
v4: Avoid separate prototype declaration.common/exports.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied.
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 About the use of language: it is impossible to sharpen a pencil with a blunt ax. It is equally vain to try to do it with ten blunt axes instead. -- Edsger Dijkstra
PATCH 5/6 Make *printf() return "int" instead of "void"
In reply to Wolfgang DenkChange the return type of the *printf() functions to the standard "int"; no changes are needed but returning the already available length count.
This will save a few additional strlen() calls later...
--- common/console.c | 12 ++++++++---- examples/api/libgenwrap.c | 6 ++++-- include/common.h | 8 ++++---- include/exports.h | 4 ++-- 4 files changed, 18 insertions(+), 12 deletions(-)
common/console.c +8 -4
@@ -201,7 +201,7 @@ static inline void console_doenv(int file, struct stdio_dev *dev)/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/ -void serial_printf (const char *fmt, ...) +int serial_printf (const char *fmt, ...) {va_list args;uint i;
@@ -216,6 +216,7 @@ void serial_printf(const char *fmt, ...)va_end (args);serial_puts (printbuffer); +return i; }int fgetc (int file)
@@ -269,7 +270,7 @@ void fputs(int file, const char *s)console_puts (file, s); } -void fprintf (int file,const char *fmt, ...) +int fprintf (int file,const char *fmt, ...) {va_list args;uint i;
@@ -285,6 +286,7 @@ void fprintf(int file, const char *fmt, ...)/* Send to desired file */ fputs (file, printbuffer); +return i; }/** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/
@@ -363,7 +365,7 @@ void puts(const char *s) } } -void printf (const char *fmt, ...) +int printf (const char *fmt, ...) {va_list args;uint i;
@@ -379,9 +381,10 @@ void printf(const char *fmt, ...)/* Print the string */ puts (printbuffer); +return i; } -void vprintf (const char *fmt,va_list args) +int vprintf (const char *fmt,va_list args) {uint i;char printbuffer[CONFIG_SYS_PBSIZE ];
@@ -393,6 +396,7 @@ void vprintf(const char *fmt, va_list args)/* Print the string */ puts (printbuffer); +return i; }/* test if ctrl-c was pressed */
examples/api/libgenwrap.c +4 -2
@@ -37,7 +37,7 @@/* * printf() and vprintf() are stolen from u-boot/common/console.c */ -void printf (const char *fmt, ...) +int printf (const char *fmt, ...) {va_list args;uint i;
@@ -53,9 +53,10 @@ void printf (const char *fmt, ...)/* Print the string */ ub_puts (printbuffer); +return i; } -void vprintf (const char *fmt,va_list args) +int vprintf (const char *fmt,va_list args) {uint i;char printbuffer[256 ];
@@ -67,6 +68,7 @@ void vprintf (const char *fmt, va_list args)/* Print the string */ ub_puts (printbuffer); +return i; }void putc (const char c)
include/common.h +4 -4
@@ -663,7 +663,7 @@ int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */* STDIO based functions (can always be used) */ /* serial stuff */ -void serial_printf (const char *fmt, ...) +int serial_printf (const char *fmt, ...) __attribute__ ((format (__printf__,1 ,2 )));/* stdin */ int getc (void );
@@ -672,9 +672,9 @@ int tstc(void);/* stdout */ void putc (const char c);void puts (const char *s); -void printf (const char *fmt, ...) +int printf (const char *fmt, ...) __attribute__ ((format (__printf__,1 ,2 ))); -void vprintf (const char *fmt,va_list args); +int vprintf (const char *fmt,va_list args);/* stderr */ #define eputc (c) fputc(stderr, c)
@@ -689,7 +689,7 @@ void vprintf(const char *fmt, va_list args);#define stderr 2#define MAX_FILES 3 -void fprintf (int file,const char *fmt, ...) +int fprintf (int file,const char *fmt, ...) __attribute__ ((format (__printf__,2 ,3 )));void fputs (int file,const char *s);void fputc (int file,const char c);
include/exports.h +2 -2
@@ -11,14 +11,14 @@ int getc(void);int tstc (void );void putc (const char );void puts (const char *); -void printf (const char * fmt, ...); +int printf (const char * fmt, ...);void install_hdlr (int ,interrupt_handler_t *,void *);void free_hdlr (int );void *malloc (size_t );void free (void *);void __udelay (unsigned long );unsigned long get_timer (unsigned long ); -void vprintf (const char *,va_list ); +int vprintf (const char *,va_list );void do_reset (void );unsigned long simple_strtoul (const char *cp,char **endp,unsigned int base);char *getenv (char *name);
Signature · 1 line
1.7.0.1
Wolfgang Denk
AppliedPATCH 5/6 Make *printf() return "int" instead of "void"
Quoted 6 lines · In message <[email protected]> you wrote:
Change the return type of the
*printf()functions to the standard "int"; no changes are needed but returning the already available length count.This will save a few additional
strlen()calls later...
Quoted 7 lines
Signed-off-by Wolfgang Denk <[email protected]>--- common/console.c | 12 ++++++++---- examples/api/libgenwrap.c | 6 ++++-- include/common.h | 8 ++++---- include/exports.h | 4 ++-- 4 files changed, 18 insertions(+), 12 deletions(-)
Applied.
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 more we disagree, the more chance there is that at least one of us is right.
PATCH 6/6 Redundant environment: move flag definitions to header file
In reply to Wolfgang DenkInstead of defining the flags sevaral times in different source files (which is error prone), move them to a central place in a header file.
--- common/env_eeprom.c | 5 ----- common/env_flash.c | 3 --- include/environment.h | 3 +++ 3 files changed, 3 insertions(+), 8 deletions(-)
common/env_eeprom.c +0 -5
@@ -32,11 +32,6 @@#include <i2c.h> #endif -#ifdef CONFIG_ENV_OFFSET_REDUND -#define ACTIVE_FLAG 1 -#define OBSOLETE_FLAG 0 -#endif -DECLARE_GLOBAL_DATA_PTR ;env_t *env_ptr =NULL ;
common/env_flash.c +0 -3
@@ -71,9 +71,6 @@ static env_t *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;/* CONFIG_ENV_ADDR is supposed to be on sector boundary */ static ulong end_addr =CONFIG_ENV_ADDR +CONFIG_ENV_SECT_SIZE -1 ;static ulong end_addr_new =CONFIG_ENV_ADDR_REDUND +CONFIG_ENV_SECT_SIZE -1 ; - -#define ACTIVE_FLAG 1 -#define OBSOLETE_FLAG 0#endif /* CONFIG_ENV_ADDR_REDUND */ extern uchar default_environment[];
include/environment.h +3 -0
@@ -122,6 +122,9 @@#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT # define ENV_HEADER_SIZE (sizeof(uint32_t) + 1) + +# define ACTIVE_FLAG 1 +# define OBSOLETE_FLAG 0#else # define ENV_HEADER_SIZE (sizeof(uint32_t))#endif
Signature · 1 line
1.7.0.1
Wolfgang Denk
AppliedPATCH 6/6 Redundant environment: move flag definitions to header file
Quoted 9 lines · In message <[email protected]> you wrote:
Instead of defining the flags sevaral times in different source files (which is error prone), move them to a central place in a header file.
Signed-off-by Wolfgang Denk <[email protected]>--- common/env_eeprom.c | 5 ----- common/env_flash.c | 3 --- include/environment.h | 3 +++ 3 files changed, 3 insertions(+), 8 deletions(-)
Applied.
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 Panic, n.: The second time you can't do it the first time.