Move initf_malloc() to a common place
authorSimon Glass <sjg@chromium.org>
Sat, 28 Feb 2015 05:06:36 +0000 (22:06 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 23 Apr 2015 15:05:53 +0000 (09:05 -0600)
To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/board_f.c
common/dlmalloc.c
include/malloc.h

index 90f3b8847f27389c1a197d987c84b1a9f4943e1c..322e0700d7384eee1ff1a23845054e13c3ea0a7b 100644 (file)
@@ -23,6 +23,7 @@
 #include <i2c.h>
 #include <initcall.h>
 #include <logbuff.h>
+#include <malloc.h>
 #include <mapmem.h>
 
 /* TODO: Can we move these into arch/ headers? */
@@ -721,17 +722,6 @@ static int mark_bootstage(void)
        return 0;
 }
 
-static int initf_malloc(void)
-{
-#ifdef CONFIG_SYS_MALLOC_F_LEN
-       assert(gd->malloc_base);        /* Set up by crt0.S */
-       gd->malloc_limit = gd->malloc_base + CONFIG_SYS_MALLOC_F_LEN;
-       gd->malloc_ptr = 0;
-#endif
-
-       return 0;
-}
-
 static int initf_dm(void)
 {
 #if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN)
index b2ce063c5f40cff0d8b64b90011a375a3a01205a..b5bb05191c240a46d0fb944356418c45f3f8ea4e 100644 (file)
@@ -3261,6 +3261,17 @@ int mALLOPt(param_number, value) int param_number; int value;
   }
 }
 
+int initf_malloc(void)
+{
+#ifdef CONFIG_SYS_MALLOC_F_LEN
+       assert(gd->malloc_base);        /* Set up by crt0.S */
+       gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
+       gd->malloc_ptr = 0;
+#endif
+
+       return 0;
+}
+
 /*
 
 History:
index 5df634873f147f93fb444b9621abf07e1e6e21e1..f4da9e6dddb67e2ccb78464558caf5aa85f5ce74 100644 (file)
@@ -906,6 +906,9 @@ void *realloc_simple(void *ptr, size_t size);
 
 #endif
 
+/* Set up pre-relocation malloc() ready for use */
+int initf_malloc(void);
+
 /* Public routines */
 
 /* Simple versions which can be used when space is tight */