aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/include/asm/rwsem.h5
-rw-r--r--arch/ia64/include/asm/rwsem.h5
-rw-r--r--arch/powerpc/include/asm/rwsem.h5
-rw-r--r--arch/s390/include/asm/rwsem.h5
-rw-r--r--arch/sh/include/asm/rwsem.h5
-rw-r--r--arch/sparc/include/asm/rwsem.h5
-rw-r--r--arch/x86/include/asm/rwsem.h5
-rw-r--r--arch/xtensa/include/asm/rwsem.h5
-rw-r--r--include/linux/rwsem.h7
9 files changed, 7 insertions, 40 deletions
diff --git a/arch/alpha/include/asm/rwsem.h b/arch/alpha/include/asm/rwsem.h
index c9f5b90e926e..fc7f54337c3a 100644
--- a/arch/alpha/include/asm/rwsem.h
+++ b/arch/alpha/include/asm/rwsem.h
@@ -224,10 +224,5 @@ static inline long rwsem_atomic_update(long val, struct rw_semaphore *sem)
224#endif 224#endif
225} 225}
226 226
227static inline int rwsem_is_locked(struct rw_semaphore *sem)
228{
229 return (sem->count != 0);
230}
231
232#endif /* __KERNEL__ */ 227#endif /* __KERNEL__ */
233#endif /* _ALPHA_RWSEM_H */ 228#endif /* _ALPHA_RWSEM_H */
diff --git a/arch/ia64/include/asm/rwsem.h b/arch/ia64/include/asm/rwsem.h
index 379854630e9d..148b61a96b8c 100644
--- a/arch/ia64/include/asm/rwsem.h
+++ b/arch/ia64/include/asm/rwsem.h
@@ -147,9 +147,4 @@ __downgrade_write (struct rw_semaphore *sem)
147#define rwsem_atomic_add(delta, sem) atomic64_add(delta, (atomic64_t *)(&(sem)->count)) 147#define rwsem_atomic_add(delta, sem) atomic64_add(delta, (atomic64_t *)(&(sem)->count))
148#define rwsem_atomic_update(delta, sem) atomic64_add_return(delta, (atomic64_t *)(&(sem)->count)) 148#define rwsem_atomic_update(delta, sem) atomic64_add_return(delta, (atomic64_t *)(&(sem)->count))
149 149
150static inline int rwsem_is_locked(struct rw_semaphore *sem)
151{
152 return (sem->count != 0);
153}
154
155#endif /* _ASM_IA64_RWSEM_H */ 150#endif /* _ASM_IA64_RWSEM_H */
diff --git a/arch/powerpc/include/asm/rwsem.h b/arch/powerpc/include/asm/rwsem.h
index f86fdf743afb..38e8e5c508d5 100644
--- a/arch/powerpc/include/asm/rwsem.h
+++ b/arch/powerpc/include/asm/rwsem.h
@@ -133,10 +133,5 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
133 return atomic_long_add_return(delta, (atomic_long_t *)&sem->count); 133 return atomic_long_add_return(delta, (atomic_long_t *)&sem->count);
134} 134}
135 135
136static inline int rwsem_is_locked(struct rw_semaphore *sem)
137{
138 return sem->count != 0;
139}
140
141#endif /* __KERNEL__ */ 136#endif /* __KERNEL__ */
142#endif /* _ASM_POWERPC_RWSEM_H */ 137#endif /* _ASM_POWERPC_RWSEM_H */
diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h
index f0f527756ee1..80522dcb6cc2 100644
--- a/arch/s390/include/asm/rwsem.h
+++ b/arch/s390/include/asm/rwsem.h
@@ -325,10 +325,5 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
325 return new; 325 return new;
326} 326}
327 327
328static inline int rwsem_is_locked(struct rw_semaphore *sem)
329{
330 return (sem->count != 0);
331}
332
333#endif /* __KERNEL__ */ 328#endif /* __KERNEL__ */
334#endif /* _S390_RWSEM_H */ 329#endif /* _S390_RWSEM_H */
diff --git a/arch/sh/include/asm/rwsem.h b/arch/sh/include/asm/rwsem.h
index 798699d0687b..2f8cf9761eb5 100644
--- a/arch/sh/include/asm/rwsem.h
+++ b/arch/sh/include/asm/rwsem.h
@@ -133,10 +133,5 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
133 return atomic_add_return(delta, (atomic_t *)(&sem->count)); 133 return atomic_add_return(delta, (atomic_t *)(&sem->count));
134} 134}
135 135
136static inline int rwsem_is_locked(struct rw_semaphore *sem)
137{
138 return (sem->count != 0);
139}
140
141#endif /* __KERNEL__ */ 136#endif /* __KERNEL__ */
142#endif /* _ASM_SH_RWSEM_H */ 137#endif /* _ASM_SH_RWSEM_H */
diff --git a/arch/sparc/include/asm/rwsem.h b/arch/sparc/include/asm/rwsem.h
index 79f7c1ca6f91..4f4391fd5658 100644
--- a/arch/sparc/include/asm/rwsem.h
+++ b/arch/sparc/include/asm/rwsem.h
@@ -124,11 +124,6 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
124 return atomic64_add_return(delta, (atomic64_t *)(&sem->count)); 124 return atomic64_add_return(delta, (atomic64_t *)(&sem->count));
125} 125}
126 126
127static inline int rwsem_is_locked(struct rw_semaphore *sem)
128{
129 return (sem->count != 0);
130}
131
132#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
133 128
134#endif /* _SPARC64_RWSEM_H */ 129#endif /* _SPARC64_RWSEM_H */
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index c0c91b4ecc81..776d76fe2f90 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -222,10 +222,5 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
222 return tmp + delta; 222 return tmp + delta;
223} 223}
224 224
225static inline int rwsem_is_locked(struct rw_semaphore *sem)
226{
227 return (sem->count != 0);
228}
229
230#endif /* __KERNEL__ */ 225#endif /* __KERNEL__ */
231#endif /* _ASM_X86_RWSEM_H */ 226#endif /* _ASM_X86_RWSEM_H */
diff --git a/arch/xtensa/include/asm/rwsem.h b/arch/xtensa/include/asm/rwsem.h
index 2fa420212353..da61633ccba8 100644
--- a/arch/xtensa/include/asm/rwsem.h
+++ b/arch/xtensa/include/asm/rwsem.h
@@ -133,9 +133,4 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
133 return atomic_add_return(delta, (atomic_t *)(&sem->count)); 133 return atomic_add_return(delta, (atomic_t *)(&sem->count));
134} 134}
135 135
136static inline int rwsem_is_locked(struct rw_semaphore *sem)
137{
138 return (sem->count != 0);
139}
140
141#endif /* _XTENSA_RWSEM_H */ 136#endif /* _XTENSA_RWSEM_H */
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 8970c3e802e2..8b9c7e9f6910 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -34,6 +34,13 @@ struct rw_semaphore {
34 34
35/* Include the arch specific part */ 35/* Include the arch specific part */
36#include <asm/rwsem.h> 36#include <asm/rwsem.h>
37
38/* In all implementations count != 0 means locked */
39static inline int rwsem_is_locked(struct rw_semaphore *sem)
40{
41 return sem->count != 0;
42}
43
37#endif 44#endif
38 45
39/* Common initializer macros and functions */ 46/* Common initializer macros and functions */