Luca's patch ported
[cbs-scheduler.git] / include / linux / debug_locks.h
blob096476f1fb356a2c17ab5d267be9a2295f55295a
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 (!oops_in_progress && 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