aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-07-03 03:24:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-03 18:27:01 -0400
commitc4e05116a2c4d8187127dbf77ab790aa57a47388 (patch)
tree58f07aed47ee4d30e9588d5a820c245faa163b09 /include/linux
parent8b3db9c542e18b71d4820da4dd9401ee030feacb (diff)
[PATCH] lockdep: clean up rwsems
Clean up rwsems. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/rwsem-spinlock.h14
-rw-r--r--include/linux/rwsem.h24
2 files changed, 1 insertions, 37 deletions
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index f30f805080ae..d68afcc36ac9 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -32,22 +32,10 @@ struct rw_semaphore {
32 __s32 activity; 32 __s32 activity;
33 spinlock_t wait_lock; 33 spinlock_t wait_lock;
34 struct list_head wait_list; 34 struct list_head wait_list;
35#if RWSEM_DEBUG
36 int debug;
37#endif
38}; 35};
39 36
40/*
41 * initialisation
42 */
43#if RWSEM_DEBUG
44#define __RWSEM_DEBUG_INIT , 0
45#else
46#define __RWSEM_DEBUG_INIT /* */
47#endif
48
49#define __RWSEM_INITIALIZER(name) \ 37#define __RWSEM_INITIALIZER(name) \
50{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEBUG_INIT } 38{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) }
51 39
52#define DECLARE_RWSEM(name) \ 40#define DECLARE_RWSEM(name) \
53 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 41 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index f99fe90732ab..93581534b915 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -9,8 +9,6 @@
9 9
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11 11
12#define RWSEM_DEBUG 0
13
14#ifdef __KERNEL__ 12#ifdef __KERNEL__
15 13
16#include <linux/types.h> 14#include <linux/types.h>
@@ -26,23 +24,13 @@ struct rw_semaphore;
26#include <asm/rwsem.h> /* use an arch-specific implementation */ 24#include <asm/rwsem.h> /* use an arch-specific implementation */
27#endif 25#endif
28 26
29#ifndef rwsemtrace
30#if RWSEM_DEBUG
31extern void FASTCALL(rwsemtrace(struct rw_semaphore *sem, const char *str));
32#else
33#define rwsemtrace(SEM,FMT)
34#endif
35#endif
36
37/* 27/*
38 * lock for reading 28 * lock for reading
39 */ 29 */
40static inline void down_read(struct rw_semaphore *sem) 30static inline void down_read(struct rw_semaphore *sem)
41{ 31{
42 might_sleep(); 32 might_sleep();
43 rwsemtrace(sem,"Entering down_read");
44 __down_read(sem); 33 __down_read(sem);
45 rwsemtrace(sem,"Leaving down_read");
46} 34}
47 35
48/* 36/*
@@ -51,9 +39,7 @@ static inline void down_read(struct rw_semaphore *sem)
51static inline int down_read_trylock(struct rw_semaphore *sem) 39static inline int down_read_trylock(struct rw_semaphore *sem)
52{ 40{
53 int ret; 41 int ret;
54 rwsemtrace(sem,"Entering down_read_trylock");
55 ret = __down_read_trylock(sem); 42 ret = __down_read_trylock(sem);
56 rwsemtrace(sem,"Leaving down_read_trylock");
57 return ret; 43 return ret;
58} 44}
59 45
@@ -63,9 +49,7 @@ static inline int down_read_trylock(struct rw_semaphore *sem)
63static inline void down_write(struct rw_semaphore *sem) 49static inline void down_write(struct rw_semaphore *sem)
64{ 50{
65 might_sleep(); 51 might_sleep();
66 rwsemtrace(sem,"Entering down_write");
67 __down_write(sem); 52 __down_write(sem);
68 rwsemtrace(sem,"Leaving down_write");
69} 53}
70 54
71/* 55/*
@@ -74,9 +58,7 @@ static inline void down_write(struct rw_semaphore *sem)
74static inline int down_write_trylock(struct rw_semaphore *sem) 58static inline int down_write_trylock(struct rw_semaphore *sem)
75{ 59{
76 int ret; 60 int ret;
77 rwsemtrace(sem,"Entering down_write_trylock");
78 ret = __down_write_trylock(sem); 61 ret = __down_write_trylock(sem);
79 rwsemtrace(sem,"Leaving down_write_trylock");
80 return ret; 62 return ret;
81} 63}
82 64
@@ -85,9 +67,7 @@ static inline int down_write_trylock(struct rw_semaphore *sem)
85 */ 67 */
86static inline void up_read(struct rw_semaphore *sem) 68static inline void up_read(struct rw_semaphore *sem)
87{ 69{
88 rwsemtrace(sem,"Entering up_read");
89 __up_read(sem); 70 __up_read(sem);
90 rwsemtrace(sem,"Leaving up_read");
91} 71}
92 72
93/* 73/*
@@ -95,9 +75,7 @@ static inline void up_read(struct rw_semaphore *sem)
95 */ 75 */
96static inline void up_write(struct rw_semaphore *sem) 76static inline void up_write(struct rw_semaphore *sem)
97{ 77{
98 rwsemtrace(sem,"Entering up_write");
99 __up_write(sem); 78 __up_write(sem);
100 rwsemtrace(sem,"Leaving up_write");
101} 79}
102 80
103/* 81/*
@@ -105,9 +83,7 @@ static inline void up_write(struct rw_semaphore *sem)
105 */ 83 */
106static inline void downgrade_write(struct rw_semaphore *sem) 84static inline void downgrade_write(struct rw_semaphore *sem)
107{ 85{
108 rwsemtrace(sem,"Entering downgrade_write");
109 __downgrade_write(sem); 86 __downgrade_write(sem);
110 rwsemtrace(sem,"Leaving downgrade_write");
111} 87}
112 88
113#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */