Merge v2.6.37-rc8 into powerpc/next
[deliverable/linux.git] / include / linux / smp_lock.h
CommitLineData
1da177e4
LT
1#ifndef __LINUX_SMPLOCK_H
2#define __LINUX_SMPLOCK_H
3
f037360f 4#ifdef CONFIG_LOCK_KERNEL
1da177e4 5#include <linux/sched.h>
1da177e4 6
1da177e4
LT
7extern int __lockfunc __reacquire_kernel_lock(void);
8extern void __lockfunc __release_kernel_lock(void);
9
10/*
11 * Release/re-acquire global kernel lock for the scheduler
12 */
13#define release_kernel_lock(tsk) do { \
14 if (unlikely((tsk)->lock_depth >= 0)) \
15 __release_kernel_lock(); \
16} while (0)
17
1da177e4
LT
18static inline int reacquire_kernel_lock(struct task_struct *task)
19{
20 if (unlikely(task->lock_depth >= 0))
6478d880 21 return __reacquire_kernel_lock();
1da177e4
LT
22 return 0;
23}
24
925936eb
FW
25extern void __lockfunc
26_lock_kernel(const char *func, const char *file, int line)
27__acquires(kernel_lock);
96a2c464 28
925936eb
FW
29extern void __lockfunc
30_unlock_kernel(const char *func, const char *file, int line)
31__releases(kernel_lock);
96a2c464 32
925936eb
FW
33#define lock_kernel() do { \
34 _lock_kernel(__func__, __FILE__, __LINE__); \
35} while (0)
36
37#define unlock_kernel() do { \
38 _unlock_kernel(__func__, __FILE__, __LINE__); \
39} while (0)
1da177e4 40
0b280676
JC
41/*
42 * Various legacy drivers don't really need the BKL in a specific
43 * function, but they *do* need to know that the BKL became available.
44 * This function just avoids wrapping a bunch of lock/unlock pairs
45 * around code which doesn't really need it.
46 */
47static inline void cycle_kernel_lock(void)
48{
49 lock_kernel();
50 unlock_kernel();
51}
52
1da177e4
LT
53#else
54
6de5bd12 55#ifdef CONFIG_BKL /* provoke build bug if not set */
925936eb
FW
56#define lock_kernel()
57#define unlock_kernel()
0b280676 58#define cycle_kernel_lock() do { } while(0)
6de5bd12
AB
59#endif /* CONFIG_BKL */
60
61#define release_kernel_lock(task) do { } while(0)
62#define reacquire_kernel_lock(task) 0
1da177e4
LT
63
64#endif /* CONFIG_LOCK_KERNEL */
65#endif /* __LINUX_SMPLOCK_H */
This page took 0.788439 seconds and 5 git commands to generate.