1 /*
2  *  include/asm-s390/smplock.h
3  *
4  *  S390 version
5  *
6  *  Derived from "include/asm-i386/smplock.h"
7  */
8 
9 #include <linux/interrupt.h>
10 #include <linux/spinlock.h>
11 
12 extern spinlock_t kernel_flag;
13 
14 #define kernel_locked()                spin_is_locked(&kernel_flag)
15 
16 /*
17  * Release global kernel lock and global interrupt lock
18  */
19 #define release_kernel_lock(task, cpu)     \
20 do {                                       \
21 	if (task->lock_depth >= 0)         \
22 		spin_unlock(&kernel_flag); \
23 	release_irqlock(cpu);              \
24 	__sti();                           \
25 } while (0)
26 
27 /*
28  * Re-acquire the kernel lock
29  */
30 #define reacquire_kernel_lock(task)        \
31 do {                                       \
32 	if (task->lock_depth >= 0)         \
33 		spin_lock(&kernel_flag);   \
34 } while (0)
35 
36 
37 /*
38  * Getting the big kernel lock.
39  *
40  * This cannot happen asynchronously,
41  * so we only need to worry about other
42  * CPU's.
43  */
44 /*
45  * Getting the big kernel lock.
46  *
47  * This cannot happen asynchronously,
48  * so we only need to worry about other
49  * CPU's.
50  */
lock_kernel(void)51 extern __inline__ void lock_kernel(void)
52 {
53         if (!++current->lock_depth)
54                 spin_lock(&kernel_flag);
55 }
56 
unlock_kernel(void)57 extern __inline__ void unlock_kernel(void)
58 {
59         if (--current->lock_depth < 0)
60                 spin_unlock(&kernel_flag);
61 }
62 
63