]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
malloc: make malloc_bin_reloc static
authorGabor Juhos <juhosg@openwrt.org>
Mon, 21 Jan 2013 21:10:38 +0000 (21:10 +0000)
committerTom Rini <trini@ti.com>
Tue, 19 Feb 2013 22:01:26 +0000 (17:01 -0500)
On architectures where manual relocation
is needed, the 'malloc_bin_reloc' function
must be called after 'mem_malloc_init'.

Make the 'malloc_bin_reloc' function static
and call it directly from 'mem_malloc_init'
instead of calling that from board_init_{r,f}
functions of the affected architectures.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Andreas Bießmann <andreas.devel@gmail.com>
Cc: Jason Jin <Jason.jin@freescale.com>
Cc: Macpaul Lin <macpaul@andestech.com>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
arch/avr32/lib/board.c
arch/m68k/lib/board.c
arch/nds32/lib/board.c
arch/sparc/lib/board.c
common/dlmalloc.c
include/malloc.h

index d3c8cb76dde081661ad0916641da1cd5fc6d363a..bd1be73ae4cc3a87c9f7bfec2e2e57e14738bfa0 100644 (file)
@@ -286,7 +286,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        /* The malloc area is right below the monitor image in RAM */
        mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
                        CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN);
-       malloc_bin_reloc();
        dma_alloc_init();
 
        enable_interrupts();
index c372ae228b5572c2208daa6a07973ffc48c73e9d..33acffe4316a7d1ff7b40cc6b84eb121636ae983 100644 (file)
@@ -449,7 +449,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
        /* The Malloc area is immediately below the monitor copy in DRAM */
        mem_malloc_init (CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
                        TOTAL_MALLOC_LEN, TOTAL_MALLOC_LEN);
-       malloc_bin_reloc ();
 
 #if !defined(CONFIG_SYS_NO_FLASH)
        puts ("Flash: ");
index 09feaf3733057ce1b30ffef87aa1214943c57b04..c919928a371620ca156e8a92d06f3db11d1f6e88 100644 (file)
@@ -320,7 +320,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
        /* The Malloc area is immediately below the monitor copy in DRAM */
        malloc_start = dest_addr - TOTAL_MALLOC_LEN;
        mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN);
-       malloc_bin_reloc();
 
 #ifndef CONFIG_SYS_NO_FLASH
        /* configure available FLASH banks */
index 1b5e995b15aaae971624fa0b584084c182f646f0..79fb4c87eff46f2fc5f2daac458bb8a992b36a0f 100644 (file)
@@ -271,7 +271,6 @@ void board_init_f(ulong bootflag)
        /* The Malloc area is immediately below the monitor copy in RAM */
        mem_malloc_init(CONFIG_SYS_MALLOC_BASE,
                        CONFIG_SYS_MALLOC_END - CONFIG_SYS_MALLOC_BASE);
-       malloc_bin_reloc();
 
 #if !defined(CONFIG_SYS_NO_FLASH)
        puts("Flash: ");
index b2f0a1ad52e2e97694a9008fed300c9470fd0823..2a9d169f92da78f291e46f9731012135e34b6c4b 100644 (file)
@@ -1485,7 +1485,7 @@ static mbinptr av_[NAV * 2 + 2] = {
 };
 
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-void malloc_bin_reloc (void)
+static void malloc_bin_reloc(void)
 {
        mbinptr *p = &av_[2];
        size_t i;
@@ -1493,6 +1493,8 @@ void malloc_bin_reloc (void)
        for (i = 2; i < ARRAY_SIZE(av_); ++i, ++p)
                *p = (mbinptr)((ulong)*p + gd->reloc_off);
 }
+#else
+static inline void malloc_bin_reloc(void) {}
 #endif
 
 ulong mem_malloc_start = 0;
@@ -1526,6 +1528,8 @@ void mem_malloc_init(ulong start, ulong size)
        mem_malloc_brk = start;
 
        memset((void *)mem_malloc_start, 0, size);
+
+       malloc_bin_reloc();
 }
 
 /* field-extraction macros */
index 84ecf79344f6f57bbd744b18eab9b07e85d5dde6..6295929ea38b4cbf9bcd8b488d0dbee2f3f5237f 100644 (file)
@@ -937,7 +937,6 @@ extern ulong mem_malloc_end;
 extern ulong mem_malloc_brk;
 
 void mem_malloc_init(ulong start, ulong size);
-void malloc_bin_reloc(void);
 
 #ifdef __cplusplus
 };  /* end of extern "C" */