aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/mutex.h10
-rw-r--r--kernel/mutex.c9
2 files changed, 2 insertions, 17 deletions
diff --git a/arch/x86/include/asm/mutex.h b/arch/x86/include/asm/mutex.h
index bc2a0b0dcea6..7d3a48275394 100644
--- a/arch/x86/include/asm/mutex.h
+++ b/arch/x86/include/asm/mutex.h
@@ -3,13 +3,3 @@
3#else 3#else
4# include <asm/mutex_64.h> 4# include <asm/mutex_64.h>
5#endif 5#endif
6
7#ifndef __ASM_MUTEX_H
8#define __ASM_MUTEX_H
9/*
10 * For the x86 architecture, it allows any negative number (besides -1) in
11 * the mutex count to indicate that some other threads are waiting on the
12 * mutex.
13 */
14#define __ARCH_ALLOW_ANY_NEGATIVE_MUTEX_COUNT 1
15#endif
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 1dbd4210baef..ad53a664f113 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -38,15 +38,10 @@
38#endif 38#endif
39 39
40/* 40/*
41 * A mutex count of -1 indicates that waiters are sleeping waiting for the 41 * A negative mutex count indicates that waiters are sleeping waiting for the
42 * mutex. Some architectures can allow any negative number, not just -1, for 42 * mutex.
43 * this purpose.
44 */ 43 */
45#ifdef __ARCH_ALLOW_ANY_NEGATIVE_MUTEX_COUNT
46#define MUTEX_SHOW_NO_WAITER(mutex) (atomic_read(&(mutex)->count) >= 0) 44#define MUTEX_SHOW_NO_WAITER(mutex) (atomic_read(&(mutex)->count) >= 0)
47#else
48#define MUTEX_SHOW_NO_WAITER(mutex) (atomic_read(&(mutex)->count) != -1)
49#endif
50 45
51void 46void
52__mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) 47__mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)