]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
hwconfig: Fix dummy initialization of {board, cpu}_hwconfig
authorKumar Gala <galak@kernel.crashing.org>
Tue, 30 Nov 2010 21:01:28 +0000 (15:01 -0600)
committerWolfgang Denk <wd@denx.de>
Tue, 30 Nov 2010 21:11:19 +0000 (22:11 +0100)
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>
board/freescale/mpc8641hpcn/mpc8641hpcn.c
board/freescale/p2020ds/p2020ds.c
common/hwconfig.c

index 812111db10070b47098e7364fb446848d568b9ef..882ff0bf2d1eb8b41f8d92ef5cebb732e19984c9 100644 (file)
@@ -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)
 {
index b507677c3fed782433f79be5899e98bc571f0d5a..b05ef989b915674e75bd0af6989ef3f447ae4858 100644 (file)
@@ -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;
index 3c9759fc557547fa8a2f0bc16fa87658fa166e23..da8d3edb07165e3e0956b31516326aafb0b6e976 100644 (file)
@@ -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
 
@@ -96,13 +96,11 @@ static const char *__hwconfig(const char *opt, size_t *arglen)
                return hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
                                      opt, ";", ':', arglen);
 
-       if (board_hwconfig)
-               return hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
-                                     opt, ";", ':', arglen);
+       return hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
+                       opt, ";", ':', arglen);
 
-       if (cpu_hwconfig)
-               return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
-                                     opt, ";", ':', arglen);
+       return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
+                       opt, ";", ':', arglen);
 
        return NULL;
 }