diff options
Diffstat (limited to 'arch/cris/include/arch-v32')
-rw-r--r-- | arch/cris/include/arch-v32/arch/spinlock.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/arch/cris/include/arch-v32/arch/spinlock.h b/arch/cris/include/arch-v32/arch/spinlock.h index e253457765f2..a2e8a394d555 100644 --- a/arch/cris/include/arch-v32/arch/spinlock.h +++ b/arch/cris/include/arch-v32/arch/spinlock.h | |||
@@ -9,12 +9,12 @@ extern void cris_spin_unlock(void *l, int val); | |||
9 | extern void cris_spin_lock(void *l); | 9 | extern void cris_spin_lock(void *l); |
10 | extern int cris_spin_trylock(void *l); | 10 | extern int cris_spin_trylock(void *l); |
11 | 11 | ||
12 | static inline int __raw_spin_is_locked(arch_spinlock_t *x) | 12 | static inline int arch_spin_is_locked(arch_spinlock_t *x) |
13 | { | 13 | { |
14 | return *(volatile signed char *)(&(x)->slock) <= 0; | 14 | return *(volatile signed char *)(&(x)->slock) <= 0; |
15 | } | 15 | } |
16 | 16 | ||
17 | static inline void __raw_spin_unlock(arch_spinlock_t *lock) | 17 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
18 | { | 18 | { |
19 | __asm__ volatile ("move.d %1,%0" \ | 19 | __asm__ volatile ("move.d %1,%0" \ |
20 | : "=m" (lock->slock) \ | 20 | : "=m" (lock->slock) \ |
@@ -22,26 +22,26 @@ static inline void __raw_spin_unlock(arch_spinlock_t *lock) | |||
22 | : "memory"); | 22 | : "memory"); |
23 | } | 23 | } |
24 | 24 | ||
25 | static inline void __raw_spin_unlock_wait(arch_spinlock_t *lock) | 25 | static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) |
26 | { | 26 | { |
27 | while (__raw_spin_is_locked(lock)) | 27 | while (arch_spin_is_locked(lock)) |
28 | cpu_relax(); | 28 | cpu_relax(); |
29 | } | 29 | } |
30 | 30 | ||
31 | static inline int __raw_spin_trylock(arch_spinlock_t *lock) | 31 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
32 | { | 32 | { |
33 | return cris_spin_trylock((void *)&lock->slock); | 33 | return cris_spin_trylock((void *)&lock->slock); |
34 | } | 34 | } |
35 | 35 | ||
36 | static inline void __raw_spin_lock(arch_spinlock_t *lock) | 36 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
37 | { | 37 | { |
38 | cris_spin_lock((void *)&lock->slock); | 38 | cris_spin_lock((void *)&lock->slock); |
39 | } | 39 | } |
40 | 40 | ||
41 | static inline void | 41 | static inline void |
42 | __raw_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) | 42 | arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) |
43 | { | 43 | { |
44 | __raw_spin_lock(lock); | 44 | arch_spin_lock(lock); |
45 | } | 45 | } |
46 | 46 | ||
47 | /* | 47 | /* |
@@ -68,64 +68,64 @@ static inline int __raw_write_can_lock(raw_rwlock_t *x) | |||
68 | 68 | ||
69 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 69 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
70 | { | 70 | { |
71 | __raw_spin_lock(&rw->slock); | 71 | arch_spin_lock(&rw->slock); |
72 | while (rw->lock == 0); | 72 | while (rw->lock == 0); |
73 | rw->lock--; | 73 | rw->lock--; |
74 | __raw_spin_unlock(&rw->slock); | 74 | arch_spin_unlock(&rw->slock); |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 77 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
78 | { | 78 | { |
79 | __raw_spin_lock(&rw->slock); | 79 | arch_spin_lock(&rw->slock); |
80 | while (rw->lock != RW_LOCK_BIAS); | 80 | while (rw->lock != RW_LOCK_BIAS); |
81 | rw->lock = 0; | 81 | rw->lock = 0; |
82 | __raw_spin_unlock(&rw->slock); | 82 | arch_spin_unlock(&rw->slock); |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 85 | static inline void __raw_read_unlock(raw_rwlock_t *rw) |
86 | { | 86 | { |
87 | __raw_spin_lock(&rw->slock); | 87 | arch_spin_lock(&rw->slock); |
88 | rw->lock++; | 88 | rw->lock++; |
89 | __raw_spin_unlock(&rw->slock); | 89 | arch_spin_unlock(&rw->slock); |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 92 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
93 | { | 93 | { |
94 | __raw_spin_lock(&rw->slock); | 94 | arch_spin_lock(&rw->slock); |
95 | while (rw->lock != RW_LOCK_BIAS); | 95 | while (rw->lock != RW_LOCK_BIAS); |
96 | rw->lock = RW_LOCK_BIAS; | 96 | rw->lock = RW_LOCK_BIAS; |
97 | __raw_spin_unlock(&rw->slock); | 97 | arch_spin_unlock(&rw->slock); |
98 | } | 98 | } |
99 | 99 | ||
100 | static inline int __raw_read_trylock(raw_rwlock_t *rw) | 100 | static inline int __raw_read_trylock(raw_rwlock_t *rw) |
101 | { | 101 | { |
102 | int ret = 0; | 102 | int ret = 0; |
103 | __raw_spin_lock(&rw->slock); | 103 | arch_spin_lock(&rw->slock); |
104 | if (rw->lock != 0) { | 104 | if (rw->lock != 0) { |
105 | rw->lock--; | 105 | rw->lock--; |
106 | ret = 1; | 106 | ret = 1; |
107 | } | 107 | } |
108 | __raw_spin_unlock(&rw->slock); | 108 | arch_spin_unlock(&rw->slock); |
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
111 | 111 | ||
112 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 112 | static inline int __raw_write_trylock(raw_rwlock_t *rw) |
113 | { | 113 | { |
114 | int ret = 0; | 114 | int ret = 0; |
115 | __raw_spin_lock(&rw->slock); | 115 | arch_spin_lock(&rw->slock); |
116 | if (rw->lock == RW_LOCK_BIAS) { | 116 | if (rw->lock == RW_LOCK_BIAS) { |
117 | rw->lock = 0; | 117 | rw->lock = 0; |
118 | ret = 1; | 118 | ret = 1; |
119 | } | 119 | } |
120 | __raw_spin_unlock(&rw->slock); | 120 | arch_spin_unlock(&rw->slock); |
121 | return 1; | 121 | return 1; |
122 | } | 122 | } |
123 | 123 | ||
124 | #define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock) | 124 | #define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock) |
125 | #define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock) | 125 | #define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock) |
126 | 126 | ||
127 | #define _raw_spin_relax(lock) cpu_relax() | 127 | #define arch_spin_relax(lock) cpu_relax() |
128 | #define _raw_read_relax(lock) cpu_relax() | 128 | #define arch_read_relax(lock) cpu_relax() |
129 | #define _raw_write_relax(lock) cpu_relax() | 129 | #define arch_write_relax(lock) cpu_relax() |
130 | 130 | ||
131 | #endif /* __ASM_ARCH_SPINLOCK_H */ | 131 | #endif /* __ASM_ARCH_SPINLOCK_H */ |