diff options
-rw-r--r-- | include/linux/lglock.h | 16 | ||||
-rw-r--r-- | kernel/locking/Makefile | 3 |
2 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/lglock.h b/include/linux/lglock.h index 96549abe8842..0081f000e34b 100644 --- a/include/linux/lglock.h +++ b/include/linux/lglock.h | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/cpu.h> | 25 | #include <linux/cpu.h> |
26 | #include <linux/notifier.h> | 26 | #include <linux/notifier.h> |
27 | 27 | ||
28 | #ifdef CONFIG_SMP | ||
29 | |||
28 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 30 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
29 | #define LOCKDEP_INIT_MAP lockdep_init_map | 31 | #define LOCKDEP_INIT_MAP lockdep_init_map |
30 | #else | 32 | #else |
@@ -57,4 +59,18 @@ void lg_local_unlock_cpu(struct lglock *lg, int cpu); | |||
57 | void lg_global_lock(struct lglock *lg); | 59 | void lg_global_lock(struct lglock *lg); |
58 | void lg_global_unlock(struct lglock *lg); | 60 | void lg_global_unlock(struct lglock *lg); |
59 | 61 | ||
62 | #else | ||
63 | /* When !CONFIG_SMP, map lglock to spinlock */ | ||
64 | #define lglock spinlock | ||
65 | #define DEFINE_LGLOCK(name) DEFINE_SPINLOCK(name) | ||
66 | #define DEFINE_STATIC_LGLOCK(name) static DEFINE_SPINLOCK(name) | ||
67 | #define lg_lock_init(lg, name) spin_lock_init(lg) | ||
68 | #define lg_local_lock spin_lock | ||
69 | #define lg_local_unlock spin_unlock | ||
70 | #define lg_local_lock_cpu(lg, cpu) spin_lock(lg) | ||
71 | #define lg_local_unlock_cpu(lg, cpu) spin_unlock(lg) | ||
72 | #define lg_global_lock spin_lock | ||
73 | #define lg_global_unlock spin_unlock | ||
74 | #endif | ||
75 | |||
60 | #endif | 76 | #endif |
diff --git a/kernel/locking/Makefile b/kernel/locking/Makefile index 306a76b51e0f..b8bdcd4785b7 100644 --- a/kernel/locking/Makefile +++ b/kernel/locking/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | obj-y += mutex.o semaphore.o rwsem.o lglock.o mcs_spinlock.o | 2 | obj-y += mutex.o semaphore.o rwsem.o mcs_spinlock.o |
3 | 3 | ||
4 | ifdef CONFIG_FUNCTION_TRACER | 4 | ifdef CONFIG_FUNCTION_TRACER |
5 | CFLAGS_REMOVE_lockdep.o = -pg | 5 | CFLAGS_REMOVE_lockdep.o = -pg |
@@ -14,6 +14,7 @@ ifeq ($(CONFIG_PROC_FS),y) | |||
14 | obj-$(CONFIG_LOCKDEP) += lockdep_proc.o | 14 | obj-$(CONFIG_LOCKDEP) += lockdep_proc.o |
15 | endif | 15 | endif |
16 | obj-$(CONFIG_SMP) += spinlock.o | 16 | obj-$(CONFIG_SMP) += spinlock.o |
17 | obj-$(CONFIG_SMP) += lglock.o | ||
17 | obj-$(CONFIG_PROVE_LOCKING) += spinlock.o | 18 | obj-$(CONFIG_PROVE_LOCKING) += spinlock.o |
18 | obj-$(CONFIG_RT_MUTEXES) += rtmutex.o | 19 | obj-$(CONFIG_RT_MUTEXES) += rtmutex.o |
19 | obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o | 20 | obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o |