aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/include/asm/rwsem.h8
-rw-r--r--arch/ia64/include/asm/rwsem.h9
-rw-r--r--arch/powerpc/include/asm/rwsem.h9
-rw-r--r--arch/s390/include/asm/rwsem.h12
-rw-r--r--arch/sh/include/asm/rwsem.h12
-rw-r--r--arch/sparc/include/asm/rwsem.h9
-rw-r--r--arch/x86/include/asm/rwsem.h12
-rw-r--r--arch/xtensa/include/asm/rwsem.h9
-rw-r--r--include/linux/rwsem.h13
9 files changed, 15 insertions, 78 deletions
diff --git a/arch/alpha/include/asm/rwsem.h b/arch/alpha/include/asm/rwsem.h
index 839a3fa20944..3e5619ead29d 100644
--- a/arch/alpha/include/asm/rwsem.h
+++ b/arch/alpha/include/asm/rwsem.h
@@ -19,20 +19,12 @@ extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
19extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); 19extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
20extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 20extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
21 21
22/*
23 * the semaphore definition
24 */
25struct rw_semaphore {
26 long count;
27#define RWSEM_UNLOCKED_VALUE 0x0000000000000000L 22#define RWSEM_UNLOCKED_VALUE 0x0000000000000000L
28#define RWSEM_ACTIVE_BIAS 0x0000000000000001L 23#define RWSEM_ACTIVE_BIAS 0x0000000000000001L
29#define RWSEM_ACTIVE_MASK 0x00000000ffffffffL 24#define RWSEM_ACTIVE_MASK 0x00000000ffffffffL
30#define RWSEM_WAITING_BIAS (-0x0000000100000000L) 25#define RWSEM_WAITING_BIAS (-0x0000000100000000L)
31#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 26#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
32#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 27#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
33 spinlock_t wait_lock;
34 struct list_head wait_list;
35};
36 28
37#define __RWSEM_INITIALIZER(name) \ 29#define __RWSEM_INITIALIZER(name) \
38 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 30 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
diff --git a/arch/ia64/include/asm/rwsem.h b/arch/ia64/include/asm/rwsem.h
index 9bcf0792b01c..1fe465804dc7 100644
--- a/arch/ia64/include/asm/rwsem.h
+++ b/arch/ia64/include/asm/rwsem.h
@@ -27,15 +27,6 @@
27 27
28#include <asm/intrinsics.h> 28#include <asm/intrinsics.h>
29 29
30/*
31 * the semaphore definition
32 */
33struct rw_semaphore {
34 signed long count;
35 spinlock_t wait_lock;
36 struct list_head wait_list;
37};
38
39#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000) 30#define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000)
40#define RWSEM_ACTIVE_BIAS (1L) 31#define RWSEM_ACTIVE_BIAS (1L)
41#define RWSEM_ACTIVE_MASK (0xffffffffL) 32#define RWSEM_ACTIVE_MASK (0xffffffffL)
diff --git a/arch/powerpc/include/asm/rwsem.h b/arch/powerpc/include/asm/rwsem.h
index c12abbe1d06f..bc1acc229223 100644
--- a/arch/powerpc/include/asm/rwsem.h
+++ b/arch/powerpc/include/asm/rwsem.h
@@ -28,15 +28,6 @@
28#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 28#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
29#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 29#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
30 30
31struct rw_semaphore {
32 long count;
33 spinlock_t wait_lock;
34 struct list_head wait_list;
35#ifdef CONFIG_DEBUG_LOCK_ALLOC
36 struct lockdep_map dep_map;
37#endif
38};
39
40#ifdef CONFIG_DEBUG_LOCK_ALLOC 31#ifdef CONFIG_DEBUG_LOCK_ALLOC
41# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 32# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
42#else 33#else
diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h
index 9cc8592b33bb..6e075f1d97b4 100644
--- a/arch/s390/include/asm/rwsem.h
+++ b/arch/s390/include/asm/rwsem.h
@@ -49,18 +49,6 @@ extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
49extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *); 49extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *);
50extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *); 50extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *);
51 51
52/*
53 * the semaphore definition
54 */
55struct rw_semaphore {
56 signed long count;
57 spinlock_t wait_lock;
58 struct list_head wait_list;
59#ifdef CONFIG_DEBUG_LOCK_ALLOC
60 struct lockdep_map dep_map;
61#endif
62};
63
64#ifndef __s390x__ 52#ifndef __s390x__
65#define RWSEM_UNLOCKED_VALUE 0x00000000 53#define RWSEM_UNLOCKED_VALUE 0x00000000
66#define RWSEM_ACTIVE_BIAS 0x00000001 54#define RWSEM_ACTIVE_BIAS 0x00000001
diff --git a/arch/sh/include/asm/rwsem.h b/arch/sh/include/asm/rwsem.h
index df6f34623c54..dffc62589f79 100644
--- a/arch/sh/include/asm/rwsem.h
+++ b/arch/sh/include/asm/rwsem.h
@@ -11,23 +11,13 @@
11#endif 11#endif
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14/* 14
15 * the semaphore definition
16 */
17struct rw_semaphore {
18 long count;
19#define RWSEM_UNLOCKED_VALUE 0x00000000 15#define RWSEM_UNLOCKED_VALUE 0x00000000
20#define RWSEM_ACTIVE_BIAS 0x00000001 16#define RWSEM_ACTIVE_BIAS 0x00000001
21#define RWSEM_ACTIVE_MASK 0x0000ffff 17#define RWSEM_ACTIVE_MASK 0x0000ffff
22#define RWSEM_WAITING_BIAS (-0x00010000) 18#define RWSEM_WAITING_BIAS (-0x00010000)
23#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 19#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
24#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 20#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
25 spinlock_t wait_lock;
26 struct list_head wait_list;
27#ifdef CONFIG_DEBUG_LOCK_ALLOC
28 struct lockdep_map dep_map;
29#endif
30};
31 21
32#ifdef CONFIG_DEBUG_LOCK_ALLOC 22#ifdef CONFIG_DEBUG_LOCK_ALLOC
33# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 23# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
diff --git a/arch/sparc/include/asm/rwsem.h b/arch/sparc/include/asm/rwsem.h
index 902d36bf150d..4c16d1de2ab5 100644
--- a/arch/sparc/include/asm/rwsem.h
+++ b/arch/sparc/include/asm/rwsem.h
@@ -12,20 +12,13 @@
12#endif 12#endif
13 13
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15struct rw_semaphore { 15
16 signed long count;
17#define RWSEM_UNLOCKED_VALUE 0x00000000L 16#define RWSEM_UNLOCKED_VALUE 0x00000000L
18#define RWSEM_ACTIVE_BIAS 0x00000001L 17#define RWSEM_ACTIVE_BIAS 0x00000001L
19#define RWSEM_ACTIVE_MASK 0xffffffffL 18#define RWSEM_ACTIVE_MASK 0xffffffffL
20#define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) 19#define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1)
21#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 20#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
22#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 21#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
23 spinlock_t wait_lock;
24 struct list_head wait_list;
25#ifdef CONFIG_DEBUG_LOCK_ALLOC
26 struct lockdep_map dep_map;
27#endif
28};
29 22
30#ifdef CONFIG_DEBUG_LOCK_ALLOC 23#ifdef CONFIG_DEBUG_LOCK_ALLOC
31# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 24# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index c30206c2bbf9..995cfe4c985d 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -49,8 +49,6 @@ extern asmregparm struct rw_semaphore *
49 rwsem_downgrade_wake(struct rw_semaphore *sem); 49 rwsem_downgrade_wake(struct rw_semaphore *sem);
50 50
51/* 51/*
52 * the semaphore definition
53 *
54 * The bias values and the counter type limits the number of 52 * The bias values and the counter type limits the number of
55 * potential readers/writers to 32767 for 32 bits and 2147483647 53 * potential readers/writers to 32767 for 32 bits and 2147483647
56 * for 64 bits. 54 * for 64 bits.
@@ -68,22 +66,12 @@ extern asmregparm struct rw_semaphore *
68#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 66#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
69#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 67#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
70 68
71struct rw_semaphore {
72 long count;
73 spinlock_t wait_lock;
74 struct list_head wait_list;
75#ifdef CONFIG_DEBUG_LOCK_ALLOC
76 struct lockdep_map dep_map;
77#endif
78};
79
80#ifdef CONFIG_DEBUG_LOCK_ALLOC 69#ifdef CONFIG_DEBUG_LOCK_ALLOC
81# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 70# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
82#else 71#else
83# define __RWSEM_DEP_MAP_INIT(lockname) 72# define __RWSEM_DEP_MAP_INIT(lockname)
84#endif 73#endif
85 74
86
87#define __RWSEM_INITIALIZER(name) \ 75#define __RWSEM_INITIALIZER(name) \
88{ \ 76{ \
89 RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 77 RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
diff --git a/arch/xtensa/include/asm/rwsem.h b/arch/xtensa/include/asm/rwsem.h
index 1be2102c648e..585cab9b0bdf 100644
--- a/arch/xtensa/include/asm/rwsem.h
+++ b/arch/xtensa/include/asm/rwsem.h
@@ -16,20 +16,13 @@
16#ifndef _LINUX_RWSEM_H 16#ifndef _LINUX_RWSEM_H
17#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead." 17#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
18#endif 18#endif
19/* 19
20 * the semaphore definition
21 */
22struct rw_semaphore {
23 signed long count;
24#define RWSEM_UNLOCKED_VALUE 0x00000000 20#define RWSEM_UNLOCKED_VALUE 0x00000000
25#define RWSEM_ACTIVE_BIAS 0x00000001 21#define RWSEM_ACTIVE_BIAS 0x00000001
26#define RWSEM_ACTIVE_MASK 0x0000ffff 22#define RWSEM_ACTIVE_MASK 0x0000ffff
27#define RWSEM_WAITING_BIAS (-0x00010000) 23#define RWSEM_WAITING_BIAS (-0x00010000)
28#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 24#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
29#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 25#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
30 spinlock_t wait_lock;
31 struct list_head wait_list;
32};
33 26
34#define __RWSEM_INITIALIZER(name) \ 27#define __RWSEM_INITIALIZER(name) \
35 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 28 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 496296d12d62..e8be18edb664 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -22,7 +22,18 @@ struct rw_semaphore;
22#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK 22#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
23#include <linux/rwsem-spinlock.h> /* use a generic implementation */ 23#include <linux/rwsem-spinlock.h> /* use a generic implementation */
24#else 24#else
25#include <asm/rwsem.h> /* use an arch-specific implementation */ 25/* All arch specific implementations share the same struct */
26struct rw_semaphore {
27 long count;
28 spinlock_t wait_lock;
29 struct list_head wait_list;
30#ifdef CONFIG_DEBUG_LOCK_ALLOC
31 struct lockdep_map dep_map;
32#endif
33};
34
35/* Include the arch specific part */
36#include <asm/rwsem.h>
26#endif 37#endif
27 38
28/* 39/*