1 #ifndef __LINUX_SMPLOCK_H
2 #define __LINUX_SMPLOCK_H
4 #ifdef CONFIG_LOCK_KERNEL
5 #include <linux/sched.h>
7 extern int __lockfunc
__reacquire_kernel_lock(void);
8 extern void __lockfunc
__release_kernel_lock(void);
11 * Release/re-acquire global kernel lock for the scheduler
13 #define release_kernel_lock(tsk) do { \
14 if (unlikely((tsk)->lock_depth >= 0)) \
15 __release_kernel_lock(); \
18 static inline int reacquire_kernel_lock(struct task_struct
*task
)
20 if (unlikely(task
->lock_depth
>= 0))
21 return __reacquire_kernel_lock();
25 extern void __lockfunc
26 _lock_kernel(const char *func
, const char *file
, int line
)
27 __acquires(kernel_lock
);
29 extern void __lockfunc
30 _unlock_kernel(const char *func
, const char *file
, int line
)
31 __releases(kernel_lock
);
33 #define lock_kernel() do { \
34 _lock_kernel(__func__, __FILE__, __LINE__); \
37 #define unlock_kernel() do { \
38 _unlock_kernel(__func__, __FILE__, __LINE__); \
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.
47 static inline void cycle_kernel_lock(void)
55 #ifdef CONFIG_BKL /* provoke build bug if not set */
57 #define unlock_kernel()
58 #define cycle_kernel_lock() do { } while(0)
59 #endif /* CONFIG_BKL */
61 #define release_kernel_lock(task) do { } while(0)
62 #define reacquire_kernel_lock(task) 0
64 #endif /* CONFIG_LOCK_KERNEL */
65 #endif /* __LINUX_SMPLOCK_H */