Create include/linux/slab.h and include/linux/vmalloc.h with memory allocation functions: slab.h: - GFP flags (GFP_KERNEL, GFP_ATOMIC, etc.) - kmalloc(), kzalloc(), kcalloc(), kmalloc_array() - kfree(), krealloc(), kmemdup() - kmem_cache_* functions vmalloc.h: - vmalloc(), vzalloc(), vfree() - __vmalloc() Update compat.h to include these headers and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
25 lines
501 B
C
25 lines
501 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* vmalloc functions for Linux kernel compatibility.
|
|
* In U-Boot, these just map to regular malloc.
|
|
*/
|
|
#ifndef _LINUX_VMALLOC_H
|
|
#define _LINUX_VMALLOC_H
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#define vmalloc(size) kmalloc(size, 0)
|
|
#define __vmalloc(size, flags, pgsz) kmalloc(size, flags)
|
|
|
|
static inline void *vzalloc(unsigned long size)
|
|
{
|
|
return kzalloc(size, 0);
|
|
}
|
|
|
|
static inline void vfree(const void *addr)
|
|
{
|
|
free((void *)addr);
|
|
}
|
|
|
|
#endif /* _LINUX_VMALLOC_H */
|