More Makefile cleanups, otherwise mainly noticeable are the netfilter fix
[davej-history.git] / include / asm-sh / smplock.h
blob6f71b8bba26423e609ad5b802cefb8c69a210675
1 #ifndef __ASM_SH_SMPLOCK_H
2 #define __ASM_SH_SMPLOCK_H
4 /*
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
10 #include <linux/config.h>
12 #ifndef CONFIG_SMP
14 #define lock_kernel() do { } while(0)
15 #define unlock_kernel() do { } while(0)
16 #define release_kernel_lock(task, cpu, depth) ((depth) = 1)
17 #define reacquire_kernel_lock(task, cpu, depth) do { } while(0)
19 #else
21 #error "We do not support SMP on SH yet"
23 * Default SMP lock implementation
26 #include <linux/interrupt.h>
27 #include <asm/spinlock.h>
29 extern spinlock_t kernel_flag;
32 * Getting the big kernel lock.
34 * This cannot happen asynchronously,
35 * so we only need to worry about other
36 * CPU's.
38 extern __inline__ void lock_kernel(void)
40 if (!++current->lock_depth)
41 spin_lock(&kernel_flag);
44 extern __inline__ void unlock_kernel(void)
46 if (--current->lock_depth < 0)
47 spin_unlock(&kernel_flag);
51 * Release global kernel lock and global interrupt lock
53 #define release_kernel_lock(task, cpu) \
54 do { \
55 if (task->lock_depth >= 0) \
56 spin_unlock(&kernel_flag); \
57 release_irqlock(cpu); \
58 __sti(); \
59 } while (0)
62 * Re-acquire the kernel lock
64 #define reacquire_kernel_lock(task) \
65 do { \
66 if (task->lock_depth >= 0) \
67 spin_lock(&kernel_flag); \
68 } while (0)
70 #endif /* CONFIG_SMP */
72 #endif /* __ASM_SH_SMPLOCK_H */