rwsem: Cleanup duplicate code all over the place
Subsystems (9)
cover rwsem: Cleanup duplicate code all over the place
The archictecture specific rwsem implementations have a lot of duplicated code. The following series cleans that up.
Thanks,
tglx
PATCH 1/6 rwsem: Cleanup includes
All rwsem implementations include the same headers. Include them from include/linux/rwsem.h
--- arch/alpha/include/asm/rwsem.h | 4 ---- arch/ia64/include/asm/rwsem.h | 3 --- arch/powerpc/include/asm/rwsem.h | 5 ----- arch/s390/include/asm/rwsem.h | 5 ----- arch/sh/include/asm/rwsem.h | 5 ----- arch/sparc/include/asm/rwsem.h | 6 ------ arch/x86/include/asm/rwsem.h | 6 ------ arch/xtensa/include/asm/rwsem.h | 6 ------ include/linux/rwsem-spinlock.h | 8 -------- include/linux/rwsem.h | 3 +++ 10 files changed, 3 insertions(+), 48 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -4
@@ -13,10 +13,6 @@#ifdef __KERNEL__#include <linux/compiler.h> -#include <linux/list.h> -#include <linux/spinlock.h> - -struct rwsem_waiter ;extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);
arch/ia64/include/asm/rwsem.h +0 -3
@@ -25,9 +25,6 @@#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."#endif -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/intrinsics.h> /*
arch/powerpc/include/asm/rwsem.h +0 -5
@@ -13,11 +13,6 @@* by Paul Mackerras <[email protected]>. */ -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> -#include <asm/system.h> -/* * the semaphore definition */
arch/s390/include/asm/rwsem.h +0 -5
@@ -43,11 +43,6 @@#ifdef __KERNEL__ -#include <linux/list.h> -#include <linux/spinlock.h> - -struct rwsem_waiter ; -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *);
arch/sh/include/asm/rwsem.h +0 -5
@@ -11,11 +11,6 @@#endif #ifdef __KERNEL__ -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> -#include <asm/system.h> -/* * the semaphore definition */
arch/sparc/include/asm/rwsem.h +0 -6
@@ -12,12 +12,6 @@#endif #ifdef __KERNEL__ - -#include <linux/list.h> -#include <linux/spinlock.h> - -struct rwsem_waiter; - struct rw_semaphore { signed long count; #define RWSEM_UNLOCKED_VALUE 0x00000000L
arch/x86/include/asm/rwsem.h +0 -6
@@ -37,14 +37,8 @@#endif #ifdef __KERNEL__ - -#include <linux/list.h> -#include <linux/spinlock.h> -#include <linux/lockdep.h> #include <asm/asm.h> -struct rwsem_waiter ; - extern asmregparm struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); extern asmregparm struct rw_semaphore *
arch/xtensa/include/asm/rwsem.h +0 -6
@@ -16,12 +16,6 @@#ifndef _LINUX_RWSEM_H#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."#endif - -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> -#include <asm/system.h> -/* * the semaphore definition */
include/linux/rwsem-spinlock.h +0 -8
@@ -12,15 +12,7 @@#error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead"#endif -#include <linux/spinlock.h> -#include <linux/list.h> -#ifdef __KERNEL__ - -#include <linux/types.h> - -struct rwsem_waiter ; -/* * the rw-semaphore definition * - if activity is 0 then there are no active readers or writers
include/linux/rwsem.h +3 -0
@@ -11,6 +11,9 @@#include <linux/types.h> #include <linux/kernel.h> +#include <linux/list.h> +#include <linux/spinlock.h> +#include <asm/system.h> #include <asm/atomic.h>
Re: [patch 1/6] rwsem: Cleanup includes
From: Thomas Gleixner <[email protected]>
Date: Wed, 26 Jan 2011 20:05:50 -0000
Quoted 4 lines
All rwsem implementations include the same headers. Include them from
include/linux/rwsem.hSigned-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] rwsem: Cleanup includes
In reply to Thomas GleixnerCommit-ID: c16a87ce063f79e0ec7d25ce2950e1bc6db03c72 Gitweb: http://git.kernel.org/tip/c16a87ce063f79e0ec7d25ce2950e1bc6db03c72 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 26 Jan 2011 20:05:50 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 27 Jan 2011 12:30:38 +0100
rwsem: Cleanup includes
All rwsem implementations include the same headers. Include them from include/linux/rwsem.h
LKML-Reference: <[email protected]>
--- arch/alpha/include/asm/rwsem.h | 4 ---- arch/ia64/include/asm/rwsem.h | 3 --- arch/powerpc/include/asm/rwsem.h | 5 ----- arch/s390/include/asm/rwsem.h | 5 ----- arch/sh/include/asm/rwsem.h | 5 ----- arch/sparc/include/asm/rwsem.h | 6 ------ arch/x86/include/asm/rwsem.h | 6 ------ arch/xtensa/include/asm/rwsem.h | 6 ------ include/linux/rwsem-spinlock.h | 8 -------- include/linux/rwsem.h | 3 +++ 10 files changed, 3 insertions(+), 48 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -4
@@ -13,10 +13,6 @@#ifdef __KERNEL__#include <linux/compiler.h> -#include <linux/list.h> -#include <linux/spinlock.h> - -struct rwsem_waiter ;extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);
arch/ia64/include/asm/rwsem.h +0 -3
@@ -25,9 +25,6 @@#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."#endif -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/intrinsics.h> /*
arch/powerpc/include/asm/rwsem.h +0 -5
@@ -13,11 +13,6 @@* by Paul Mackerras <[email protected]>. */ -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> -#include <asm/system.h> -/* * the semaphore definition */
arch/s390/include/asm/rwsem.h +0 -5
@@ -43,11 +43,6 @@#ifdef __KERNEL__ -#include <linux/list.h> -#include <linux/spinlock.h> - -struct rwsem_waiter ; -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *);
arch/sh/include/asm/rwsem.h +0 -5
@@ -11,11 +11,6 @@#endif #ifdef __KERNEL__ -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> -#include <asm/system.h> -/* * the semaphore definition */
arch/sparc/include/asm/rwsem.h +0 -6
@@ -12,12 +12,6 @@#endif #ifdef __KERNEL__ - -#include <linux/list.h> -#include <linux/spinlock.h> - -struct rwsem_waiter; - struct rw_semaphore { signed long count; #define RWSEM_UNLOCKED_VALUE 0x00000000L
arch/x86/include/asm/rwsem.h +0 -6
@@ -37,14 +37,8 @@#endif #ifdef __KERNEL__ - -#include <linux/list.h> -#include <linux/spinlock.h> -#include <linux/lockdep.h> #include <asm/asm.h> -struct rwsem_waiter ; - extern asmregparm struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); extern asmregparm struct rw_semaphore *
arch/xtensa/include/asm/rwsem.h +0 -6
@@ -16,12 +16,6 @@#ifndef _LINUX_RWSEM_H#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."#endif - -#include <linux/list.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> -#include <asm/system.h> -/* * the semaphore definition */
include/linux/rwsem-spinlock.h +0 -8
@@ -12,15 +12,7 @@#error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead"#endif -#include <linux/spinlock.h> -#include <linux/list.h> -#ifdef __KERNEL__ - -#include <linux/types.h> - -struct rwsem_waiter ; -/* * the rw-semaphore definition * - if activity is 0 then there are no active readers or writers
include/linux/rwsem.h +3 -0
@@ -11,6 +11,9 @@#include <linux/types.h> #include <linux/kernel.h> +#include <linux/list.h> +#include <linux/spinlock.h> +#include <asm/system.h> #include <asm/atomic.h>
PATCH 2/6 x86: Cleanup rwsem_count_t typedef
In reply to Thomas GleixnerRemove the typedef which has no real reason to be there.
--- arch/x86/include/asm/rwsem.h | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
arch/x86/include/asm/rwsem.h +10 -15
@@ -68,10 +68,8 @@ extern asmregparm struct rw_semaphore *#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -typedef signed long rwsem_count_t ; -struct rw_semaphore { -rwsem_count_t count; +long count;spinlock_t wait_lock;struct list_head wait_list;#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -127,7 +125,7 @@ static inline void __down_read(struct rw*/ static inline int __down_read_trylock (struct rw_semaphore *sem) { -rwsem_count_t result, tmp; +long result, tmp; asmvolatile ("# beginning __down_read_trylock\n\t" " mov %0,%1\n\t" "1:\n\t"
@@ -149,7 +147,7 @@ static inline int __down_read_trylock(st*/ static inline void __down_write_nested (struct rw_semaphore *sem,int subclass) { -rwsem_count_t tmp; +long tmp; asmvolatile ("# beginning down_write\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* adds 0xffff0001, returns the old value */
@@ -174,9 +172,8 @@ static inline void __down_write(struct r*/ static inline int __down_write_trylock (struct rw_semaphore *sem) { -rwsem_count_t ret =cmpxchg (&sem->count, -RWSEM_UNLOCKED_VALUE , -RWSEM_ACTIVE_WRITE_BIAS ); +long ret =cmpxchg (&sem->count,RWSEM_UNLOCKED_VALUE , +RWSEM_ACTIVE_WRITE_BIAS );if (ret ==RWSEM_UNLOCKED_VALUE )return 1 ;return 0 ;
@@ -187,7 +184,7 @@ static inline int __down_write_trylock(s*/ static inline void __up_read (struct rw_semaphore *sem) { -rwsem_count_t tmp; +long tmp; asmvolatile ("# beginning __up_read\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* subtracts 1, returns the old value */
@@ -205,7 +202,7 @@ static inline void __up_read(struct rw_s*/ static inline void __up_write (struct rw_semaphore *sem) { -rwsem_count_t tmp; +long tmp; asmvolatile ("# beginning __up_write\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* subtracts 0xffff0001, returns the old value */
@@ -241,8 +238,7 @@ static inline void __downgrade_write(str/* * implement atomic add functionality */ -static inline void rwsem_atomic_add (rwsem_count_t delta, -struct rw_semaphore *sem) +static inline void rwsem_atomic_add (long delta,struct rw_semaphore *sem) { asm volatile(LOCK_PREFIX _ASM_ADD "%1,%0" : "+m" (sem->count)
@@ -252,10 +248,9 @@ static inline void rwsem_atomic_add(rwse/* * implement exchange and add functionality */ -static inline rwsem_count_t rwsem_atomic_update (rwsem_count_t delta, -struct rw_semaphore *sem) +static inline long rwsem_atomic_update (long delta,struct rw_semaphore *sem) { -rwsem_count_t tmp = delta; +long tmp = delta; asmvolatile (LOCK_PREFIX "xadd %0,%1" : "+r" (tmp), "+m" (sem->count)
[tip:core/locking] x86: Cleanup rwsem_count_t typedef
Commit-ID: bde11efbc21ea84c3351464a422b467eaefabb9a Gitweb: http://git.kernel.org/tip/bde11efbc21ea84c3351464a422b467eaefabb9a Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 26 Jan 2011 20:05:53 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 27 Jan 2011 12:30:38 +0100
x86: Cleanup rwsem_count_t typedef
Remove the typedef which has no real reason to be there.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/rwsem.h | 25 ++++++++++--------------- 1 files changed, 10 insertions(+), 15 deletions(-)
arch/x86/include/asm/rwsem.h +10 -15
@@ -68,10 +68,8 @@ extern asmregparm struct rw_semaphore *#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -typedef signed long rwsem_count_t ; -struct rw_semaphore { -rwsem_count_t count; +long count;spinlock_t wait_lock;struct list_head wait_list;#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -127,7 +125,7 @@ static inline void __down_read(struct rw_semaphore *sem)*/ static inline int __down_read_trylock (struct rw_semaphore *sem) { -rwsem_count_t result, tmp; +long result, tmp; asmvolatile ("# beginning __down_read_trylock\n\t" " mov %0,%1\n\t" "1:\n\t"
@@ -149,7 +147,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)*/ static inline void __down_write_nested (struct rw_semaphore *sem,int subclass) { -rwsem_count_t tmp; +long tmp; asmvolatile ("# beginning down_write\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* adds 0xffff0001, returns the old value */
@@ -174,9 +172,8 @@ static inline void __down_write(struct rw_semaphore *sem)*/ static inline int __down_write_trylock (struct rw_semaphore *sem) { -rwsem_count_t ret =cmpxchg (&sem->count, -RWSEM_UNLOCKED_VALUE , -RWSEM_ACTIVE_WRITE_BIAS ); +long ret =cmpxchg (&sem->count,RWSEM_UNLOCKED_VALUE , +RWSEM_ACTIVE_WRITE_BIAS );if (ret ==RWSEM_UNLOCKED_VALUE )return 1 ;return 0 ;
@@ -187,7 +184,7 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)*/ static inline void __up_read (struct rw_semaphore *sem) { -rwsem_count_t tmp; +long tmp; asmvolatile ("# beginning __up_read\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* subtracts 1, returns the old value */
@@ -205,7 +202,7 @@ static inline void __up_read(struct rw_semaphore *sem)*/ static inline void __up_write (struct rw_semaphore *sem) { -rwsem_count_t tmp; +long tmp; asmvolatile ("# beginning __up_write\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* subtracts 0xffff0001, returns the old value */
@@ -241,8 +238,7 @@ static inline void __downgrade_write(struct rw_semaphore *sem)/* * implement atomic add functionality */ -static inline void rwsem_atomic_add (rwsem_count_t delta, -struct rw_semaphore *sem) +static inline void rwsem_atomic_add (long delta,struct rw_semaphore *sem) { asm volatile(LOCK_PREFIX _ASM_ADD "%1,%0" : "+m" (sem->count)
@@ -252,10 +248,9 @@ static inline void rwsem_atomic_add(rwsem_count_t delta,/* * implement exchange and add functionality */ -static inline rwsem_count_t rwsem_atomic_update (rwsem_count_t delta, -struct rw_semaphore *sem) +static inline long rwsem_atomic_update (long delta,struct rw_semaphore *sem) { -rwsem_count_t tmp = delta; +long tmp = delta; asmvolatile (LOCK_PREFIX "xadd %0,%1" : "+r" (tmp), "+m" (sem->count)
PATCH 3/6 rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h
In reply to Thomas GleixnerThe 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.
--- arch/alpha/include/asm/rwsem.h | 8 -------- arch/ia64/include/asm/rwsem.h | 9 --------- arch/powerpc/include/asm/rwsem.h | 9 --------- arch/s390/include/asm/rwsem.h | 12 ------------ arch/sh/include/asm/rwsem.h | 12 +----------- arch/sparc/include/asm/rwsem.h | 9 +-------- arch/x86/include/asm/rwsem.h | 12 ------------ arch/xtensa/include/asm/rwsem.h | 9 +-------- include/linux/rwsem.h | 13 ++++++++++++- 9 files changed, 15 insertions(+), 78 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -8
@@ -19,20 +19,12 @@ extern struct rw_semaphore *rwsem_down_wextern 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, \
arch/ia64/include/asm/rwsem.h +0 -9
@@ -27,15 +27,6 @@#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)
arch/powerpc/include/asm/rwsem.h +0 -9
@@ -28,15 +28,6 @@#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
arch/s390/include/asm/rwsem.h +0 -12
@@ -49,18 +49,6 @@ extern struct rw_semaphore *rwsem_wake(sextern 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
arch/sh/include/asm/rwsem.h +1 -11
@@ -11,23 +11,13 @@#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 }
arch/sparc/include/asm/rwsem.h +1 -8
@@ -12,20 +12,13 @@#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 }
arch/x86/include/asm/rwsem.h +0 -12
@@ -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), \
arch/xtensa/include/asm/rwsem.h +1 -8
@@ -16,20 +16,13 @@#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, \
include/linux/rwsem.h +12 -1
@@ -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 /*
Re: [patch 3/6] rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h
From: Thomas Gleixner <[email protected]>
Date: Wed, 26 Jan 2011 20:05:56 -0000
Quoted 7 lines
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_mapmember does not hurt anyone.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h
In reply to Thomas GleixnerCommit-ID: 1c8ed640d918290ddc1de5ada02ef6686a733c9f Gitweb: http://git.kernel.org/tip/1c8ed640d918290ddc1de5ada02ef6686a733c9f Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 26 Jan 2011 20:05:56 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 27 Jan 2011 12:30:39 +0100
rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h
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.
LKML-Reference: <[email protected]>
--- arch/alpha/include/asm/rwsem.h | 8 -------- arch/ia64/include/asm/rwsem.h | 9 --------- arch/powerpc/include/asm/rwsem.h | 9 --------- arch/s390/include/asm/rwsem.h | 12 ------------ arch/sh/include/asm/rwsem.h | 12 +----------- arch/sparc/include/asm/rwsem.h | 9 +-------- arch/x86/include/asm/rwsem.h | 12 ------------ arch/xtensa/include/asm/rwsem.h | 9 +-------- include/linux/rwsem.h | 13 ++++++++++++- 9 files changed, 15 insertions(+), 78 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -8
@@ -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), \
arch/ia64/include/asm/rwsem.h +0 -9
@@ -27,15 +27,6 @@#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)
arch/powerpc/include/asm/rwsem.h +0 -9
@@ -28,15 +28,6 @@#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
arch/s390/include/asm/rwsem.h +0 -12
@@ -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
arch/sh/include/asm/rwsem.h +1 -11
@@ -11,23 +11,13 @@#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 }
arch/sparc/include/asm/rwsem.h +1 -8
@@ -12,20 +12,13 @@#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 }
arch/x86/include/asm/rwsem.h +0 -12
@@ -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), \
arch/xtensa/include/asm/rwsem.h +1 -8
@@ -16,20 +16,13 @@#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), \
include/linux/rwsem.h +12 -1
@@ -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 /*
PATCH 4/6 rwsem: Move duplicate init macros and functions to linux/rwsem.h
In reply to Thomas GleixnerThe rwsem initializers and related macros and functions are mostly the same. Some of them lack the lockdep initializer, but having it in place does not matter for architectures which do not support lockdep.
powerpc, sparc, x86: No functional change
sh, s390: Removes the duplicate init_rwsem (inline and #define)
alpha, ia64, xtensa: Use the lockdep capable init function in
lib/rwsem.c which is just uninlining the init function for the LOCKDEP=n case
--- arch/alpha/include/asm/rwsem.h | 14 -------------- arch/ia64/include/asm/rwsem.h | 15 --------------- arch/powerpc/include/asm/rwsem.h | 27 --------------------------- arch/s390/include/asm/rwsem.h | 35 ----------------------------------- arch/sh/include/asm/rwsem.h | 31 ------------------------------- arch/sparc/include/asm/rwsem.h | 23 ----------------------- arch/x86/include/asm/rwsem.h | 25 ------------------------- arch/xtensa/include/asm/rwsem.h | 14 -------------- include/linux/rwsem-spinlock.h | 23 +---------------------- include/linux/rwsem.h | 25 +++++++++++++++++++++++++ 10 files changed, 26 insertions(+), 206 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -14
@@ -26,20 +26,6 @@ extern struct rw_semaphore *rwsem_downgr#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ - LIST_HEAD_INIT((name).wait_list) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -static inline void __down_read (struct rw_semaphore *sem) {long oldcount;
arch/ia64/include/asm/rwsem.h +0 -15
@@ -34,26 +34,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ - LIST_HEAD_INIT((name).wait_list) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -static inline void -init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -/* * lock for reading */
arch/powerpc/include/asm/rwsem.h +0 -27
@@ -28,38 +28,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) \ - __RWSEM_DEP_MAP_INIT(name) \ -} - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ - do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ - } while (0) -/* * lock for reading */
arch/s390/include/asm/rwsem.h +0 -35
@@ -64,41 +64,6 @@ extern struct rw_semaphore *rwsem_downgr#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)/* -* initialisation -*/ - -#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), \ - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} - -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) - - -/* * lock for reading */ static inline void __down_read (struct rw_semaphore *sem)
arch/sh/include/asm/rwsem.h +0 -31
@@ -19,42 +19,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) \ - __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) - -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -/* * lock for reading */
arch/sparc/include/asm/rwsem.h +0 -23
@@ -20,34 +20,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) -/* * lock for reading */
arch/x86/include/asm/rwsem.h +0 -25
@@ -66,31 +66,6 @@ extern asmregparm struct rw_semaphore *#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) \ -} - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) -/* * lock for reading */
arch/xtensa/include/asm/rwsem.h +0 -14
@@ -24,25 +24,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ - LIST_HEAD_INIT((name).wait_list) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -/* * lock for reading */
include/linux/rwsem-spinlock.h +1 -22
@@ -29,28 +29,7 @@ struct rw_semaphore {#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) \ -{ 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \ - __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) +#define RWSEM_UNLOCKED_VALUE 0x00000000extern void __down_read (struct rw_semaphore *sem);extern int __down_read_trylock (struct rw_semaphore *sem);
include/linux/rwsem.h +25 -0
@@ -36,6 +36,31 @@ struct rw_semaphore {#include <asm/rwsem.h> #endif +/* Common initializer macros and functions */ + +#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), \ + LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } + +#define DECLARE_RWSEM (name) \ + struct rw_semaphore name = __RWSEM_INITIALIZER(name) + +extern void __init_rwsem (struct rw_semaphore *sem,const char *name, +struct lock_class_key *key); + +#define init_rwsem (sem) \ +do { \ + static struct lock_class_key __key; \ + \ + __init_rwsem((sem), #sem, &__key); \ +} while (0) +/* * lock for reading */
Re: [patch 4/6] rwsem: Move duplicate init macros and functions to linux/rwsem.h
From: Thomas Gleixner <[email protected]>
Date: Wed, 26 Jan 2011 20:06:00 -0000
Quoted 6 lines
The rwsem initializers and related macros and functions are mostly the same. Some of them lack the lockdep initializer, but having it in place does not matter for architectures which do not support lockdep.
powerpc, sparc, x86: No functional change
Quoted 7 lines
sh, s390: Removes the duplicate
init_rwsem(inline and #define)alpha, ia64, xtensa: Use the lockdep capable init function in
lib/rwsem.cwhich is just uninlining the init function for the LOCKDEP=n caseSigned-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] rwsem: Move duplicate init macros and functions to linux/rwsem.h
In reply to Thomas GleixnerCommit-ID: 12249b34414dba7f386aadcf6be7ca36c6878300 Gitweb: http://git.kernel.org/tip/12249b34414dba7f386aadcf6be7ca36c6878300 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 26 Jan 2011 20:06:00 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 27 Jan 2011 12:30:39 +0100
rwsem: Move duplicate init macros and functions to linux/rwsem.h
The rwsem initializers and related macros and functions are mostly the same. Some of them lack the lockdep initializer, but having it in place does not matter for architectures which do not support lockdep.
powerpc, sparc, x86: No functional change
sh, s390: Removes the duplicate init_rwsem (inline and #define)
alpha, ia64, xtensa: Use the lockdep capable init function in
lib/rwsem.c which is just uninlining the init function for the LOCKDEP=n case
LKML-Reference: <[email protected]>
--- arch/alpha/include/asm/rwsem.h | 14 -------------- arch/ia64/include/asm/rwsem.h | 15 --------------- arch/powerpc/include/asm/rwsem.h | 27 --------------------------- arch/s390/include/asm/rwsem.h | 35 ----------------------------------- arch/sh/include/asm/rwsem.h | 31 ------------------------------- arch/sparc/include/asm/rwsem.h | 23 ----------------------- arch/x86/include/asm/rwsem.h | 25 ------------------------- arch/xtensa/include/asm/rwsem.h | 14 -------------- include/linux/rwsem-spinlock.h | 23 +---------------------- include/linux/rwsem.h | 25 +++++++++++++++++++++++++ 10 files changed, 26 insertions(+), 206 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -14
@@ -26,20 +26,6 @@ extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ - LIST_HEAD_INIT((name).wait_list) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -static inline void __down_read (struct rw_semaphore *sem) {long oldcount;
arch/ia64/include/asm/rwsem.h +0 -15
@@ -34,26 +34,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ - LIST_HEAD_INIT((name).wait_list) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -static inline void -init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -/* * lock for reading */
arch/powerpc/include/asm/rwsem.h +0 -27
@@ -28,38 +28,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) \ - __RWSEM_DEP_MAP_INIT(name) \ -} - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ - do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ - } while (0) -/* * lock for reading */
arch/s390/include/asm/rwsem.h +0 -35
@@ -64,41 +64,6 @@ extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *);#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)/* -* initialisation -*/ - -#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), \ - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} - -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) - - -/* * lock for reading */ static inline void __down_read (struct rw_semaphore *sem)
arch/sh/include/asm/rwsem.h +0 -31
@@ -19,42 +19,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) \ - __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) - -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -/* * lock for reading */
arch/sparc/include/asm/rwsem.h +0 -23
@@ -20,34 +20,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) -/* * lock for reading */
arch/x86/include/asm/rwsem.h +0 -25
@@ -66,31 +66,6 @@ extern asmregparm struct rw_semaphore *#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#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), \ - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) \ -} - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) -/* * lock for reading */
arch/xtensa/include/asm/rwsem.h +0 -14
@@ -24,25 +24,11 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -#define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ - LIST_HEAD_INIT((name).wait_list) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -static inline void init_rwsem (struct rw_semaphore *sem) -{ - sem->count =RWSEM_UNLOCKED_VALUE ; -spin_lock_init (&sem->wait_lock); -INIT_LIST_HEAD (&sem->wait_list); -} -/* * lock for reading */
include/linux/rwsem-spinlock.h +1 -22
@@ -29,28 +29,7 @@ struct rw_semaphore {#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) \ -{ 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \ - __RWSEM_DEP_MAP_INIT(name) } - -#define DECLARE_RWSEM (name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -extern void __init_rwsem (struct rw_semaphore *sem,const char *name, -struct lock_class_key *key); - -#define init_rwsem (sem) \ -do { \ - static struct lock_class_key __key; \ - \ - __init_rwsem((sem), #sem, &__key); \ -} while (0) +#define RWSEM_UNLOCKED_VALUE 0x00000000extern void __down_read (struct rw_semaphore *sem);extern int __down_read_trylock (struct rw_semaphore *sem);
include/linux/rwsem.h +25 -0
@@ -36,6 +36,31 @@ struct rw_semaphore {#include <asm/rwsem.h> #endif +/* Common initializer macros and functions */ + +#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), \ + LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } + +#define DECLARE_RWSEM (name) \ + struct rw_semaphore name = __RWSEM_INITIALIZER(name) + +extern void __init_rwsem (struct rw_semaphore *sem,const char *name, +struct lock_class_key *key); + +#define init_rwsem (sem) \ +do { \ + static struct lock_class_key __key; \ + \ + __init_rwsem((sem), #sem, &__key); \ +} while (0) +/* * lock for reading */
PATCH 5/6 rwsem: Unify the duplicate rwsem_is_locked() inlines
In reply to Thomas GleixnerInstead of having the same implementation in each architecture, move it to linux/rwsem.h and remove the duplicates. It's unlikely that an arch will ever implement something different, but we can deal with that when it happens.
--- arch/alpha/include/asm/rwsem.h | 5 ----- arch/ia64/include/asm/rwsem.h | 5 ----- arch/powerpc/include/asm/rwsem.h | 5 ----- arch/s390/include/asm/rwsem.h | 5 ----- arch/sh/include/asm/rwsem.h | 5 ----- arch/sparc/include/asm/rwsem.h | 5 ----- arch/x86/include/asm/rwsem.h | 5 ----- arch/xtensa/include/asm/rwsem.h | 5 ----- include/linux/rwsem.h | 7 +++++++ 9 files changed, 7 insertions(+), 40 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -5
@@ -224,10 +224,5 @@ static inline long rwsem_atomic_update(l#endif } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _ALPHA_RWSEM_H */
arch/ia64/include/asm/rwsem.h +0 -5
@@ -147,9 +147,4 @@ __downgrade_write (struct rw_semaphore *#define rwsem_atomic_add (delta, sem) atomic64_add(delta, (atomic64_t *)(&(sem)->count))#define rwsem_atomic_update (delta, sem) atomic64_add_return(delta, (atomic64_t *)(&(sem)->count)) -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* _ASM_IA64_RWSEM_H */
arch/powerpc/include/asm/rwsem.h +0 -5
@@ -133,10 +133,5 @@ static inline long rwsem_atomic_update(lreturn atomic_long_add_return (delta, (atomic_long_t *)&sem->count); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return sem->count !=0 ; -} -#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_RWSEM_H */
arch/s390/include/asm/rwsem.h +0 -5
@@ -325,10 +325,5 @@ static inline long rwsem_atomic_update(lreturn new; } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _S390_RWSEM_H */
arch/sh/include/asm/rwsem.h +0 -5
@@ -133,10 +133,5 @@ static inline int rwsem_atomic_update(inreturn atomic_add_return (delta, (atomic_t *)(&sem->count)); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _ASM_SH_RWSEM_H */
arch/sparc/include/asm/rwsem.h +0 -5
@@ -124,11 +124,6 @@ static inline long rwsem_atomic_update(lreturn atomic64_add_return (delta, (atomic64_t *)(&sem->count)); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _SPARC64_RWSEM_H */
arch/x86/include/asm/rwsem.h +0 -5
@@ -222,10 +222,5 @@ static inline long rwsem_atomic_update(lreturn tmp + delta; } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _ASM_X86_RWSEM_H */
arch/xtensa/include/asm/rwsem.h +0 -5
@@ -133,9 +133,4 @@ static inline int rwsem_atomic_update(in return atomic_add_return(delta, (atomic_t *)(&sem->count)); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* _XTENSA_RWSEM_H */
include/linux/rwsem.h +7 -0
@@ -34,6 +34,13 @@ struct rw_semaphore {/* Include the arch specific part */ #include <asm/rwsem.h> + +/* In all implementations count != 0 means locked */ +static inline int rwsem_is_locked (struct rw_semaphore *sem) +{ +return sem->count !=0 ; +} +#endif /* Common initializer macros and functions */
Re: [patch 5/6] rwsem: Unify the duplicate rwsem_is_locked() inlines
From: Thomas Gleixner <[email protected]>
Date: Wed, 26 Jan 2011 20:06:03 -0000
Quoted 6 lines
Instead of having the same implementation in each architecture, move it to
linux/rwsem.hand remove the duplicates. It's unlikely that an arch will ever implement something different, but we can deal with that when it happens.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] rwsem: Unify the duplicate rwsem_is_locked() inlines
In reply to Thomas GleixnerCommit-ID: 41e5887fa39ab272d9266a09cbefdef270e28b93 Gitweb: http://git.kernel.org/tip/41e5887fa39ab272d9266a09cbefdef270e28b93 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 26 Jan 2011 20:06:03 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 27 Jan 2011 12:30:39 +0100
rwsem: Unify the duplicate rwsem_is_locked() inlines
Instead of having the same implementation in each architecture, move it to linux/rwsem.h and remove the duplicates. It's unlikely that an arch will ever implement something different, but we can deal with that when it happens.
LKML-Reference: <[email protected]>
--- arch/alpha/include/asm/rwsem.h | 5 ----- arch/ia64/include/asm/rwsem.h | 5 ----- arch/powerpc/include/asm/rwsem.h | 5 ----- arch/s390/include/asm/rwsem.h | 5 ----- arch/sh/include/asm/rwsem.h | 5 ----- arch/sparc/include/asm/rwsem.h | 5 ----- arch/x86/include/asm/rwsem.h | 5 ----- arch/xtensa/include/asm/rwsem.h | 5 ----- include/linux/rwsem.h | 7 +++++++ 9 files changed, 7 insertions(+), 40 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -5
@@ -224,10 +224,5 @@ static inline long rwsem_atomic_update(long val, struct rw_semaphore *sem)#endif } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _ALPHA_RWSEM_H */
arch/ia64/include/asm/rwsem.h +0 -5
@@ -147,9 +147,4 @@ __downgrade_write (struct rw_semaphore *sem)#define rwsem_atomic_add (delta, sem) atomic64_add(delta, (atomic64_t *)(&(sem)->count))#define rwsem_atomic_update (delta, sem) atomic64_add_return(delta, (atomic64_t *)(&(sem)->count)) -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* _ASM_IA64_RWSEM_H */
arch/powerpc/include/asm/rwsem.h +0 -5
@@ -133,10 +133,5 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)return atomic_long_add_return (delta, (atomic_long_t *)&sem->count); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return sem->count !=0 ; -} -#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_RWSEM_H */
arch/s390/include/asm/rwsem.h +0 -5
@@ -325,10 +325,5 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)return new; } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _S390_RWSEM_H */
arch/sh/include/asm/rwsem.h +0 -5
@@ -133,10 +133,5 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)return atomic_add_return (delta, (atomic_t *)(&sem->count)); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _ASM_SH_RWSEM_H */
arch/sparc/include/asm/rwsem.h +0 -5
@@ -124,11 +124,6 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)return atomic64_add_return (delta, (atomic64_t *)(&sem->count)); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _SPARC64_RWSEM_H */
arch/x86/include/asm/rwsem.h +0 -5
@@ -222,10 +222,5 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)return tmp + delta; } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* __KERNEL__ */ #endif /* _ASM_X86_RWSEM_H */
arch/xtensa/include/asm/rwsem.h +0 -5
@@ -133,9 +133,4 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) return atomic_add_return(delta, (atomic_t *)(&sem->count)); } -static inline int rwsem_is_locked (struct rw_semaphore *sem) -{ -return (sem->count !=0 ); -} -#endif /* _XTENSA_RWSEM_H */
include/linux/rwsem.h +7 -0
@@ -34,6 +34,13 @@ struct rw_semaphore {/* Include the arch specific part */ #include <asm/rwsem.h> + +/* In all implementations count != 0 means locked */ +static inline int rwsem_is_locked (struct rw_semaphore *sem) +{ +return sem->count !=0 ; +} +#endif /* Common initializer macros and functions */
PATCH 6/6 rwsem: Move duplicate function prototypes to linux/rwsem.h
In reply to Thomas GleixnerAll architecture specific rwsem headers carry the same function prototypes. Just x86 adds asmregparm, which is an empty define on all other architectures. S390 has a stale rwsem_downgrade_write() prototype.
Remove the duplicates and add the prototypes to linux/rwsem.h
--- arch/alpha/include/asm/rwsem.h | 5 ----- arch/ia64/include/asm/rwsem.h | 5 ----- arch/powerpc/include/asm/rwsem.h | 5 ----- arch/s390/include/asm/rwsem.h | 6 ------ arch/sh/include/asm/rwsem.h | 5 ----- arch/sparc/include/asm/rwsem.h | 5 ----- arch/x86/include/asm/rwsem.h | 9 --------- arch/xtensa/include/asm/rwsem.h | 5 ----- include/linux/rwsem.h | 5 +++++ 9 files changed, 5 insertions(+), 45 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -5
@@ -14,11 +14,6 @@#include <linux/compiler.h> -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -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); -#define RWSEM_UNLOCKED_VALUE 0x0000000000000000L#define RWSEM_ACTIVE_BIAS 0x0000000000000001L#define RWSEM_ACTIVE_MASK 0x00000000ffffffffL
arch/ia64/include/asm/rwsem.h +0 -5
@@ -34,11 +34,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/powerpc/include/asm/rwsem.h +0 -5
@@ -28,11 +28,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/s390/include/asm/rwsem.h +0 -6
@@ -43,12 +43,6 @@#ifdef __KERNEL__ -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *); -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 *); -#ifndef __s390x__#define RWSEM_UNLOCKED_VALUE 0x00000000#define RWSEM_ACTIVE_BIAS 0x00000001
arch/sh/include/asm/rwsem.h +0 -5
@@ -19,11 +19,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/sparc/include/asm/rwsem.h +0 -5
@@ -20,11 +20,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/x86/include/asm/rwsem.h +0 -9
@@ -39,15 +39,6 @@#ifdef __KERNEL__#include <asm/asm.h> -extern asmregparm struct rw_semaphore * -rwsem_down_read_failed (struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore * -rwsem_down_write_failed (struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore * -rwsem_wake (struct rw_semaphore *); -extern asmregparm struct rw_semaphore * -rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * The bias values and the counter type limits the number of * potential readers/writers to 32767 for 32 bits and 2147483647
arch/xtensa/include/asm/rwsem.h +0 -5
@@ -24,11 +24,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
include/linux/rwsem.h +5 -0
@@ -32,6 +32,11 @@ struct rw_semaphore {#endif }; +extern asmregparm struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); +extern asmregparm struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); +extern asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *); +extern asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); +/* Include the arch specific part */ #include <asm/rwsem.h>
rwsem: rwsem: Remove redundant asmregparm annotation
Peter Zijlstra pointed out, that the only user of asmregparm (x86) is compiling the kernel already with -mregparm=3. So the annotation of the rwsem functions is redundant. Remove it.
--- include/linux/rwsem.h | 8 ++++---- lib/rwsem.c | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-)
include/linux/rwsem.h +4 -4
@@ -32,10 +32,10 @@ struct rw_semaphore {#endif }; -extern asmregparm struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *); -extern asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); +extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); +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);/* Include the arch specific part */ #include <asm/rwsem.h>
lib/rwsem.c +4 -6
@@ -222,8 +222,7 @@ rwsem_down_failed_common(struct rw_semap/* * wait for the read lock to be granted */ -asmregparm struct rw_semaphore __sched * -rwsem_down_read_failed (struct rw_semaphore *sem) +struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem) {return rwsem_down_failed_common (sem,RWSEM_WAITING_FOR_READ , -RWSEM_ACTIVE_READ_BIAS );
@@ -232,8 +231,7 @@ rwsem_down_read_failed(struct rw_semapho/* * wait for the write lock to be granted */ -asmregparm struct rw_semaphore __sched * -rwsem_down_write_failed (struct rw_semaphore *sem) +struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem) {return rwsem_down_failed_common (sem,RWSEM_WAITING_FOR_WRITE , -RWSEM_ACTIVE_WRITE_BIAS );
@@ -243,7 +241,7 @@ rwsem_down_write_failed(struct rw_semaph* handle waking up a waiter on the semaphore * - up_read/up_write has decremented the active part of count if we come here */ -asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) +struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem) {unsigned long flags;
@@ -263,7 +261,7 @@ asmregparm struct rw_semaphore *rwsem_wa* - caller incremented waiting part of count and discovered it still negative * - just wake up any readers at the front of the queue */ -asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) +struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem) {unsigned long flags;
[tip:core/locking] rwsem: Remove redundant asmregparm annotation
Commit-ID: d123375425d7df4b6081a631fc1203fceafa59b2 Gitweb: http://git.kernel.org/tip/d123375425d7df4b6081a631fc1203fceafa59b2 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 26 Jan 2011 21:32:01 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 27 Jan 2011 12:30:40 +0100
rwsem: Remove redundant asmregparm annotation
Peter Zijlstra pointed out, that the only user of asmregparm (x86) is compiling the kernel already with -mregparm=3. So the annotation of the rwsem functions is redundant. Remove it.
LKML-Reference: <[email protected]>
--- include/linux/rwsem.h | 8 ++++---- lib/rwsem.c | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-)
include/linux/rwsem.h +4 -4
@@ -32,10 +32,10 @@ struct rw_semaphore {#endif }; -extern asmregparm struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *); -extern asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); +extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); +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);/* Include the arch specific part */ #include <asm/rwsem.h>
lib/rwsem.c +4 -6
@@ -222,8 +222,7 @@ rwsem_down_failed_common(struct rw_semaphore *sem,/* * wait for the read lock to be granted */ -asmregparm struct rw_semaphore __sched * -rwsem_down_read_failed (struct rw_semaphore *sem) +struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem) {return rwsem_down_failed_common (sem,RWSEM_WAITING_FOR_READ , -RWSEM_ACTIVE_READ_BIAS );
@@ -232,8 +231,7 @@ rwsem_down_read_failed(struct rw_semaphore *sem)/* * wait for the write lock to be granted */ -asmregparm struct rw_semaphore __sched * -rwsem_down_write_failed (struct rw_semaphore *sem) +struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem) {return rwsem_down_failed_common (sem,RWSEM_WAITING_FOR_WRITE , -RWSEM_ACTIVE_WRITE_BIAS );
@@ -243,7 +241,7 @@ rwsem_down_write_failed(struct rw_semaphore *sem)* handle waking up a waiter on the semaphore * - up_read/up_write has decremented the active part of count if we come here */ -asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) +struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem) {unsigned long flags;
@@ -263,7 +261,7 @@ asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)* - caller incremented waiting part of count and discovered it still negative * - just wake up any readers at the front of the queue */ -asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) +struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem) {unsigned long flags;
Re: rwsem: rwsem: Remove redundant asmregparm annotation
In reply to Thomas GleixnerQuoted 3 lines · Thomas Gleixner
Peter Zijlstra pointed out, that the only user of asmregparm (x86) is compiling the kernel already with -mregparm=3. So the annotation of the rwsem functions is redundant. Remove it.
That's fine - as long as we never remove the -mregparm=3 on i386. The inline assembly relies on the regparm=3 calling convention.
David
Re: rwsem: rwsem: Remove redundant asmregparm annotation
Quoted 8 lines · David Howells
Quoted 3 lines · Thomas Gleixner
Peter Zijlstra pointed out, that the only user of asmregparm (x86) is compiling the kernel already with -mregparm=3. So the annotation of the rwsem functions is redundant. Remove it.
That's fine - as long as we never remove the -mregparm=3 on i386. The inline assembly relies on the regparm=3 calling convention.
If we remove that we'll break more than rwsems :)
Thanks,
tglx
Re: [patch 6/6] rwsem: Move duplicate function prototypes to linux/rwsem.h
In reply to Thomas GleixnerFrom: Thomas Gleixner <[email protected]>
Date: Wed, 26 Jan 2011 20:06:06 -0000
Quoted 8 lines
All architecture specific rwsem headers carry the same function prototypes. Just x86 adds asmregparm, which is an empty define on all other architectures. S390 has a stale
rwsem_downgrade_write()prototype.Remove the duplicates and add the prototypes to
linux/rwsem.hSigned-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] rwsem: Move duplicate function prototypes to linux/rwsem.h
In reply to Thomas GleixnerCommit-ID: aac72277fda6ef788bb8d5deaa502ce9b9b6e472 Gitweb: http://git.kernel.org/tip/aac72277fda6ef788bb8d5deaa502ce9b9b6e472 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 26 Jan 2011 20:06:06 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 27 Jan 2011 12:30:39 +0100
rwsem: Move duplicate function prototypes to linux/rwsem.h
All architecture specific rwsem headers carry the same function prototypes. Just x86 adds asmregparm, which is an empty define on all other architectures. S390 has a stale rwsem_downgrade_write() prototype.
Remove the duplicates and add the prototypes to linux/rwsem.h
LKML-Reference: <[email protected]>
--- arch/alpha/include/asm/rwsem.h | 5 ----- arch/ia64/include/asm/rwsem.h | 5 ----- arch/powerpc/include/asm/rwsem.h | 5 ----- arch/s390/include/asm/rwsem.h | 6 ------ arch/sh/include/asm/rwsem.h | 5 ----- arch/sparc/include/asm/rwsem.h | 5 ----- arch/x86/include/asm/rwsem.h | 9 --------- arch/xtensa/include/asm/rwsem.h | 5 ----- include/linux/rwsem.h | 5 +++++ 9 files changed, 5 insertions(+), 45 deletions(-)
arch/alpha/include/asm/rwsem.h +0 -5
@@ -14,11 +14,6 @@#include <linux/compiler.h> -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -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); -#define RWSEM_UNLOCKED_VALUE 0x0000000000000000L#define RWSEM_ACTIVE_BIAS 0x0000000000000001L#define RWSEM_ACTIVE_MASK 0x00000000ffffffffL
arch/ia64/include/asm/rwsem.h +0 -5
@@ -34,11 +34,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/powerpc/include/asm/rwsem.h +0 -5
@@ -28,11 +28,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/s390/include/asm/rwsem.h +0 -6
@@ -43,12 +43,6 @@#ifdef __KERNEL__ -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *); -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 *); -#ifndef __s390x__#define RWSEM_UNLOCKED_VALUE 0x00000000#define RWSEM_ACTIVE_BIAS 0x00000001
arch/sh/include/asm/rwsem.h +0 -5
@@ -19,11 +19,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/sparc/include/asm/rwsem.h +0 -5
@@ -20,11 +20,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
arch/x86/include/asm/rwsem.h +0 -9
@@ -39,15 +39,6 @@#ifdef __KERNEL__#include <asm/asm.h> -extern asmregparm struct rw_semaphore * -rwsem_down_read_failed (struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore * -rwsem_down_write_failed (struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore * -rwsem_wake (struct rw_semaphore *); -extern asmregparm struct rw_semaphore * -rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * The bias values and the counter type limits the number of * potential readers/writers to 32767 for 32 bits and 2147483647
arch/xtensa/include/asm/rwsem.h +0 -5
@@ -24,11 +24,6 @@#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem); -extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem); -/* * lock for reading */
include/linux/rwsem.h +5 -0
@@ -32,6 +32,11 @@ struct rw_semaphore {#endif }; +extern asmregparm struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); +extern asmregparm struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); +extern asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *); +extern asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); +/* Include the arch specific part */ #include <asm/rwsem.h>
Quoted 2 lines · Thomas Gleixner
The archictecture specific rwsem implementations have a lot of duplicated code. The following series cleans that up.
Looks good. Builds on all my ia64 configs. Boots & runs on at least one.
Quoted 2 lines · Thomas Gleixner
The archictecture specific rwsem implementations have a lot of duplicated code. The following series cleans that up.
builds and boots on s390. As far as s390 is concerned:
Quoted 2 lines · Thomas Gleixner
The archictecture specific rwsem implementations have a lot of duplicated code. The following series cleans that up.
to all patches in the series.