Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / debug_locks.h
blob4aaa4afb1cb99f849bb345a8189153e65e94cbcd
1 #ifndef __LINUX_DEBUG_LOCKING_H
2 #define __LINUX_DEBUG_LOCKING_H
4 #include <linux/kernel.h>
6 struct task_struct;
8 extern int debug_locks;
9 extern int debug_locks_silent;
12 * Generic 'turn off all lock debugging' function:
14 extern int debug_locks_off(void);
16 #define DEBUG_LOCKS_WARN_ON(c) \
17 ({ \
18 int __ret = 0; \
20 if (unlikely(c)) { \
21 if (debug_locks_off() && !debug_locks_silent) \
22 WARN_ON(1); \
23 __ret = 1; \
24 } \
25 __ret; \
28 #ifdef CONFIG_SMP
29 # define SMP_DEBUG_LOCKS_WARN_ON(c) DEBUG_LOCKS_WARN_ON(c)
30 #else
31 # define SMP_DEBUG_LOCKS_WARN_ON(c) do { } while (0)
32 #endif
34 #ifdef CONFIG_DEBUG_LOCKING_API_SELFTESTS
35 extern void locking_selftest(void);
36 #else
37 # define locking_selftest() do { } while (0)
38 #endif
40 struct task_struct;
42 #ifdef CONFIG_LOCKDEP
43 extern void debug_show_all_locks(void);
44 extern void __debug_show_held_locks(struct task_struct *task);
45 extern void debug_show_held_locks(struct task_struct *task);
46 extern void debug_check_no_locks_freed(const void *from, unsigned long len);
47 extern void debug_check_no_locks_held(struct task_struct *task);
48 #else
49 static inline void debug_show_all_locks(void)
53 static inline void __debug_show_held_locks(struct task_struct *task)
57 static inline void debug_show_held_locks(struct task_struct *task)
61 static inline void
62 debug_check_no_locks_freed(const void *from, unsigned long len)
66 static inline void
67 debug_check_no_locks_held(struct task_struct *task)
70 #endif
72 #endif