diff options
author | Heiko Schocher <hs@denx.de> | 2014-06-24 10:10:03 +0200 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-08-25 19:25:03 -0400 |
commit | 0c06db59836746c5caf397e642cd0f2bf1cc20a6 (patch) | |
tree | 05e4b719e9f17ec646581f1b8f2be785eb78c139 /lib | |
parent | cc96c9a79c4d33d70cd448380aca98916b994464 (diff) | |
download | u-boot-imx-0c06db59836746c5caf397e642cd0f2bf1cc20a6.zip u-boot-imx-0c06db59836746c5caf397e642cd0f2bf1cc20a6.tar.gz u-boot-imx-0c06db59836746c5caf397e642cd0f2bf1cc20a6.tar.bz2 |
lib, linux: move linux specific defines to linux/compat.h
- move linux specific defines from usb and video code
into linux/compat.h
- move common linux specific defines from include/ubi_uboot.h
to linux/compat.h
- add for new mtd/ubi/ubifs sync new needed linux specific
defines to linux/compat.h
Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
[trini: Add spin_lock_irqsave/spin_unlock_irqrestore dummies from
usb/lin_gadet_compat.h]
Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 1 | ||||
-rw-r--r-- | lib/linux_compat.c | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile index 9b1c237..320197a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -59,6 +59,7 @@ obj-y += crc32.o obj-y += ctype.o obj-y += div64.o obj-y += hang.o +obj-y += linux_compat.o obj-y += linux_string.o obj-$(CONFIG_REGEX) += slre.o obj-y += string.o diff --git a/lib/linux_compat.c b/lib/linux_compat.c new file mode 100644 index 0000000..a3d4675 --- /dev/null +++ b/lib/linux_compat.c @@ -0,0 +1,47 @@ + +#include <common.h> +#include <linux/compat.h> + +struct p_current cur = { + .pid = 1, +}; +__maybe_unused struct p_current *current = &cur; + +unsigned long copy_from_user(void *dest, const void *src, + unsigned long count) +{ + memcpy((void *)dest, (void *)src, count); + return 0; +} + +void *kmalloc(size_t size, int flags) +{ + return memalign(ARCH_DMA_MINALIGN, size); +} + +void *kzalloc(size_t size, int flags) +{ + void *ptr = kmalloc(size, flags); + memset(ptr, 0, size); + return ptr; +} + +void *vzalloc(unsigned long size) +{ + return kzalloc(size, 0); +} + +struct kmem_cache *get_mem(int element_sz) +{ + struct kmem_cache *ret; + + ret = memalign(ARCH_DMA_MINALIGN, sizeof(struct kmem_cache)); + ret->sz = element_sz; + + return ret; +} + +void *kmem_cache_alloc(struct kmem_cache *obj, int flag) +{ + return memalign(ARCH_DMA_MINALIGN, obj->sz); +} |