diff options
Diffstat (limited to 'arch/blackfin/kernel/sys_bfin.c')
-rw-r--r-- | arch/blackfin/kernel/sys_bfin.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c index 2e7f8e10bf87..bdc1e2f0da32 100644 --- a/arch/blackfin/kernel/sys_bfin.c +++ b/arch/blackfin/kernel/sys_bfin.c | |||
@@ -47,3 +47,26 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, | |||
47 | } | 47 | } |
48 | EXPORT_SYMBOL(get_fb_unmapped_area); | 48 | EXPORT_SYMBOL(get_fb_unmapped_area); |
49 | #endif | 49 | #endif |
50 | |||
51 | /* Needed for legacy userspace atomic emulation */ | ||
52 | static DEFINE_SPINLOCK(bfin_spinlock_lock); | ||
53 | |||
54 | #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1 | ||
55 | __attribute__((l1_text)) | ||
56 | #endif | ||
57 | asmlinkage int sys_bfin_spinlock(int *p) | ||
58 | { | ||
59 | int ret, tmp = 0; | ||
60 | |||
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); | ||
68 | } | ||
69 | spin_unlock(&bfin_spinlock_lock); | ||
70 | |||
71 | return ret; | ||
72 | } | ||