First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / powerpc / lib / alloc.c
blobf53e09c7dac72d95af83ccdca072ccde135db6af
1 #include <linux/types.h>
2 #include <linux/init.h>
3 #include <linux/slab.h>
4 #include <linux/bootmem.h>
5 #include <linux/string.h>
7 #include <asm/system.h>
9 void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
11 if (mem_init_done)
12 return kmalloc(size, mask);
13 else
14 return alloc_bootmem(size);
17 void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
19 void *p;
21 if (mem_init_done)
22 p = kzalloc(size, mask);
23 else {
24 p = alloc_bootmem(size);
25 if (p)
26 memset(p, 0, size);
28 return p;