]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h
authorThomas Gleixner <tglx@linutronix.de>
Wed, 26 Jan 2011 20:05:56 +0000 (20:05 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 27 Jan 2011 11:30:39 +0000 (12:30 +0100)
The difference between these declarations is the data type of the
count member and the lack of lockdep in some architectures/

long is equivivalent to signed long and the #ifdef guarded dep_map
member does not hurt anyone.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Matt Turner <mattst88@gmail.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Acked-by: David Miller <davem@davemloft.net>
Cc: Chris Zankel <chris@zankel.net>
LKML-Reference: <20110126195833.679641914@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/alpha/include/asm/rwsem.h
arch/ia64/include/asm/rwsem.h
arch/powerpc/include/asm/rwsem.h
arch/s390/include/asm/rwsem.h
arch/sh/include/asm/rwsem.h
arch/sparc/include/asm/rwsem.h
arch/x86/include/asm/rwsem.h
arch/xtensa/include/asm/rwsem.h
include/linux/rwsem.h

index 839a3fa209441529fd48a511016da853aaddf67b..3e5619ead29d8e33dd5c57327a44377952ed2b24 100644 (file)
@@ -19,20 +19,12 @@ extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
 extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
 extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
 
-/*
- * the semaphore definition
- */
-struct rw_semaphore {
-       long                    count;
 #define RWSEM_UNLOCKED_VALUE           0x0000000000000000L
 #define RWSEM_ACTIVE_BIAS              0x0000000000000001L
 #define RWSEM_ACTIVE_MASK              0x00000000ffffffffL
 #define RWSEM_WAITING_BIAS             (-0x0000000100000000L)
 #define RWSEM_ACTIVE_READ_BIAS         RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS                (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
-       spinlock_t              wait_lock;
-       struct list_head        wait_list;
-};
 
 #define __RWSEM_INITIALIZER(name) \
        { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
index 9bcf0792b01c090a9fe290546e1275936bf41122..1fe465804dc70b3858b6c65218ce4b5ec132602f 100644 (file)
 
 #include <asm/intrinsics.h>
 
-/*
- * the semaphore definition
- */
-struct rw_semaphore {
-       signed long             count;
-       spinlock_t              wait_lock;
-       struct list_head        wait_list;
-};
-
 #define RWSEM_UNLOCKED_VALUE           __IA64_UL_CONST(0x0000000000000000)
 #define RWSEM_ACTIVE_BIAS              (1L)
 #define RWSEM_ACTIVE_MASK              (0xffffffffL)
index c12abbe1d06f17e01230045921bc195d8bc3d9c7..bc1acc229223455ca6c3fbf3247ace23a86f3b86 100644 (file)
 #define RWSEM_ACTIVE_READ_BIAS         RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS                (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
 
-struct rw_semaphore {
-       long                    count;
-       spinlock_t              wait_lock;
-       struct list_head        wait_list;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-       struct lockdep_map      dep_map;
-#endif
-};
-
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
 #else
index 9cc8592b33bb647499a9f59c0efba0e361af0ee1..6e075f1d97b4e2d6a080e39ab8fe21757cf9cfe8 100644 (file)
@@ -49,18 +49,6 @@ extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
 extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *);
 extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *);
 
-/*
- * the semaphore definition
- */
-struct rw_semaphore {
-       signed long             count;
-       spinlock_t              wait_lock;
-       struct list_head        wait_list;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-       struct lockdep_map      dep_map;
-#endif
-};
-
 #ifndef __s390x__
 #define RWSEM_UNLOCKED_VALUE   0x00000000
 #define RWSEM_ACTIVE_BIAS      0x00000001
index df6f34623c5452095d7f62a33dc249cf0336f720..dffc62589f7928019e864115f307dff1ee476fdb 100644 (file)
 #endif
 
 #ifdef __KERNEL__
-/*
- * the semaphore definition
- */
-struct rw_semaphore {
-       long            count;
+
 #define RWSEM_UNLOCKED_VALUE           0x00000000
 #define RWSEM_ACTIVE_BIAS              0x00000001
 #define RWSEM_ACTIVE_MASK              0x0000ffff
 #define RWSEM_WAITING_BIAS             (-0x00010000)
 #define RWSEM_ACTIVE_READ_BIAS         RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS                (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
-       spinlock_t              wait_lock;
-       struct list_head        wait_list;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-       struct lockdep_map      dep_map;
-#endif
-};
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
index 902d36bf150d360a0a34671347524fa28d29c322..4c16d1de2ab5e60aa47cb0486bf3a5abe54d8b89 100644 (file)
 #endif
 
 #ifdef __KERNEL__
-struct rw_semaphore {
-       signed long                     count;
+
 #define RWSEM_UNLOCKED_VALUE           0x00000000L
 #define RWSEM_ACTIVE_BIAS              0x00000001L
 #define RWSEM_ACTIVE_MASK              0xffffffffL
 #define RWSEM_WAITING_BIAS             (-RWSEM_ACTIVE_MASK-1)
 #define RWSEM_ACTIVE_READ_BIAS         RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS                (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
-       spinlock_t                      wait_lock;
-       struct list_head                wait_list;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-       struct lockdep_map              dep_map;
-#endif
-};
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
index c30206c2bbf95739c2537f84c2c82b643ccbb17b..995cfe4c985d1e1be014f47e7c55dab6f00ea581 100644 (file)
@@ -49,8 +49,6 @@ extern asmregparm struct rw_semaphore *
  rwsem_downgrade_wake(struct rw_semaphore *sem);
 
 /*
- * the semaphore definition
- *
  * The bias values and the counter type limits the number of
  * potential readers/writers to 32767 for 32 bits and 2147483647
  * for 64 bits.
@@ -68,22 +66,12 @@ extern asmregparm struct rw_semaphore *
 #define RWSEM_ACTIVE_READ_BIAS         RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS                (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
 
-struct rw_semaphore {
-       long                    count;
-       spinlock_t              wait_lock;
-       struct list_head        wait_list;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-       struct lockdep_map dep_map;
-#endif
-};
-
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
 #else
 # define __RWSEM_DEP_MAP_INIT(lockname)
 #endif
 
-
 #define __RWSEM_INITIALIZER(name)                              \
 {                                                              \
        RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
index 1be2102c648edc94e502d859b16ba9c048638379..585cab9b0bdf3b3ed98cdb6ff403664f1efd07c6 100644 (file)
 #ifndef _LINUX_RWSEM_H
 #error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
 #endif
-/*
- * the semaphore definition
- */
-struct rw_semaphore {
-       signed long             count;
+
 #define RWSEM_UNLOCKED_VALUE           0x00000000
 #define RWSEM_ACTIVE_BIAS              0x00000001
 #define RWSEM_ACTIVE_MASK              0x0000ffff
 #define RWSEM_WAITING_BIAS             (-0x00010000)
 #define RWSEM_ACTIVE_READ_BIAS         RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS                (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
-       spinlock_t              wait_lock;
-       struct list_head        wait_list;
-};
 
 #define __RWSEM_INITIALIZER(name) \
        { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
index 496296d12d62a183304a443caa921cb0fd821538..e8be18edb66413e897e1aff361ba04ec92e07e98 100644 (file)
@@ -22,7 +22,18 @@ struct rw_semaphore;
 #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
 #include <linux/rwsem-spinlock.h> /* use a generic implementation */
 #else
-#include <asm/rwsem.h> /* use an arch-specific implementation */
+/* All arch specific implementations share the same struct */
+struct rw_semaphore {
+       long                    count;
+       spinlock_t              wait_lock;
+       struct list_head        wait_list;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       struct lockdep_map      dep_map;
+#endif
+};
+
+/* Include the arch specific part */
+#include <asm/rwsem.h>
 #endif
 
 /*