mmap: call unlink_anon_vmas() in __split_vma() in case of error
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / blackfin / kernel / sys_bfin.c
blobbdc1e2f0da32383420a46ef6c1e3fe93a805c0ea
1 /*
2 * contains various random system calls that have a non-standard
3 * calling sequence on the Linux/Blackfin platform.
5 * Copyright 2004-2009 Analog Devices Inc.
7 * Licensed under the GPL-2 or later
8 */
10 #include <linux/spinlock.h>
11 #include <linux/sem.h>
12 #include <linux/msg.h>
13 #include <linux/shm.h>
14 #include <linux/syscalls.h>
15 #include <linux/mman.h>
16 #include <linux/file.h>
17 #include <linux/fs.h>
18 #include <linux/uaccess.h>
19 #include <linux/ipc.h>
20 #include <linux/unistd.h>
22 #include <asm/cacheflush.h>
23 #include <asm/dma.h>
25 asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
27 return sram_alloc_with_lsl(size, flags);
30 asmlinkage int sys_sram_free(const void *addr)
32 return sram_free_with_lsl(addr);
35 asmlinkage void *sys_dma_memcpy(void *dest, const void *src, size_t len)
37 return safe_dma_memcpy(dest, src, len);
40 #if defined(CONFIG_FB) || defined(CONFIG_FB_MODULE)
41 #include <linux/fb.h>
42 unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr,
43 unsigned long len, unsigned long pgoff, unsigned long flags)
45 struct fb_info *info = filp->private_data;
46 return (unsigned long)info->screen_base;
48 EXPORT_SYMBOL(get_fb_unmapped_area);
49 #endif
51 /* Needed for legacy userspace atomic emulation */
52 static DEFINE_SPINLOCK(bfin_spinlock_lock);
54 #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
55 __attribute__((l1_text))
56 #endif
57 asmlinkage int sys_bfin_spinlock(int *p)
59 int ret, tmp = 0;
61 spin_lock(&bfin_spinlock_lock); /* This would also hold kernel preemption. */
62 ret = get_user(tmp, p);
63 if (likely(ret == 0)) {
64 if (unlikely(tmp))
65 ret = 1;
66 else
67 put_user(1, p);
69 spin_unlock(&bfin_spinlock_lock);
71 return ret;