提交 a84642a3 编写于 作者: M Michal Simek

microblaze: Add {z,}alloc_maybe_bootmem functions

I will need {z,}alloc_maybe_bootmem functions for pci patches
Signed-off-by: NMichal Simek <monstr@monstr.eu>
上级 2549edd3
......@@ -87,6 +87,9 @@ void free_initmem(void);
extern char *klimit;
extern void ret_from_fork(void);
extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
#ifdef CONFIG_DEBUG_FS
extern struct dentry *of_debugfs_root;
#endif
......
......@@ -349,4 +349,27 @@ void __init *early_get_page(void)
}
return p;
}
void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
{
if (mem_init_done)
return kmalloc(size, mask);
else
return alloc_bootmem(size);
}
void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
{
void *p;
if (mem_init_done)
p = kzalloc(size, mask);
else {
p = alloc_bootmem(size);
if (p)
memset(p, 0, size);
}
return p;
}
#endif /* CONFIG_MMU */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册