diff mbox

[U-Boot,v2] hwconfig: Fix dummy initialization of {board, cpu}_hwconfig

Message ID 1291144301-19594-1-git-send-email-galak@kernel.crashing.org
State Superseded
Delegated to: Wolfgang Denk
Headers show

Commit Message

Kumar Gala Nov. 30, 2010, 7:11 p.m. UTC
Since board_hwconfig & cpu_hwconfig are defined as weak and dont have a
default value they will get put into the BSS if they aren't defined
elsewhere.  This is problematic as we try to utilize hwconfig before
we've relocated and thus BSS isn't setup.

Instead of giving dummy values in the board files that utilize this
feature, we can just initialize the variables to an empty string and
thus move them out of the BSS if they aren't defined elsewhere.

Also made board_hwconfig & cpu_hwconfig arrays to reduce size associated
with string pointers vs arrays.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
* Incorporate Jocke about use of arrays vs pointers

 board/freescale/mpc8641hpcn/mpc8641hpcn.c |    3 ---
 board/freescale/p2020ds/p2020ds.c         |    3 ---
 common/hwconfig.c                         |    4 ++--
 3 files changed, 2 insertions(+), 8 deletions(-)

Comments

Scott Wood Nov. 30, 2010, 8:46 p.m. UTC | #1
On Tue, 30 Nov 2010 13:11:41 -0600
Kumar Gala <galak@kernel.crashing.org> wrote:

> diff --git a/common/hwconfig.c b/common/hwconfig.c
> index 3c9759f..752bfc3 100644
> --- a/common/hwconfig.c
> +++ b/common/hwconfig.c
> @@ -68,8 +68,8 @@ next:
>  	return NULL;
>  }
>  
> -const char *cpu_hwconfig __attribute__((weak));
> -const char *board_hwconfig __attribute__((weak));
> +const char cpu_hwconfig[] __attribute__((weak)) = "";
> +const char board_hwconfig[] __attribute__((weak)) = "";
>  
>  #define HWCONFIG_PRE_RELOC_BUF_SIZE	128
>  

With this we should be able to get rid of the NULL tests of these
variables in __hwconfig() (not that they were doing much good
before...) and save a few bytes.

-Scott
diff mbox

Patch

diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
index 812111d..882ff0b 100644
--- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -60,9 +60,6 @@  int checkboard(void)
 	return 0;
 }
 
-const char *board_hwconfig = "foo:bar=baz";
-const char *cpu_hwconfig = "foo:bar=baz";
-
 phys_size_t
 initdram(int board_type)
 {
diff --git a/board/freescale/p2020ds/p2020ds.c b/board/freescale/p2020ds/p2020ds.c
index b507677..b05ef98 100644
--- a/board/freescale/p2020ds/p2020ds.c
+++ b/board/freescale/p2020ds/p2020ds.c
@@ -69,9 +69,6 @@  int checkboard(void)
 	return 0;
 }
 
-const char *board_hwconfig = "foo:bar=baz";
-const char *cpu_hwconfig = "foo:bar=baz";
-
 phys_size_t initdram(int board_type)
 {
 	phys_size_t dram_size = 0;
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 3c9759f..752bfc3 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -68,8 +68,8 @@  next:
 	return NULL;
 }
 
-const char *cpu_hwconfig __attribute__((weak));
-const char *board_hwconfig __attribute__((weak));
+const char cpu_hwconfig[] __attribute__((weak)) = "";
+const char board_hwconfig[] __attribute__((weak)) = "";
 
 #define HWCONFIG_PRE_RELOC_BUF_SIZE	128