Fix IP22 timer calibration.
[linux-2.6/linux-mips.git] / include / asm-arm / smplock.h
blob7b70d4629ad4d4755a99e8c788a68c4bd3f7a5a5
1 /*
2 * <asm/smplock.h>
4 * Default SMP lock implementation
5 */
6 #include <linux/config.h>
7 #include <linux/interrupt.h>
8 #include <linux/spinlock.h>
10 extern spinlock_t kernel_flag;
12 #ifdef CONFIG_PREEMPT
13 #define kernel_locked() preempt_get_count()
14 #else
15 #define kernel_locked() spin_is_locked(&kernel_flag)
16 #endif
19 * Release global kernel lock and global interrupt lock
21 #define release_kernel_lock(task, cpu) \
22 do { \
23 if (unlikely(task->lock_depth >= 0)) \
24 spin_unlock(&kernel_flag); \
25 } while (0)
28 * Re-acquire the kernel lock
30 #define reacquire_kernel_lock(task) \
31 do { \
32 if (unlikely(task->lock_depth >= 0)) \
33 spin_lock(&kernel_flag); \
34 } while (0)
38 * Getting the big kernel lock.
40 * This cannot happen asynchronously,
41 * so we only need to worry about other
42 * CPU's.
44 static inline void lock_kernel(void)
46 #ifdef CONFIG_PREEMPT
47 if (current->lock_depth == -1)
48 spin_lock(&kernel_flag);
49 ++current->lock_depth;
50 #else
51 if (!++current->lock_depth)
52 spin_lock(&kernel_flag);
53 #endif
56 static inline void unlock_kernel(void)
58 if (--current->lock_depth < 0)
59 spin_unlock(&kernel_flag);