mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 10:39:08 +00:00
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>
This commit is contained in:
parent
cc96c9a79c
commit
0c06db5983
11 changed files with 385 additions and 235 deletions
47
lib/linux_compat.c
Normal file
47
lib/linux_compat.c
Normal file
|
@ -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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue