diff options
Diffstat (limited to 'arch/s390/lib/spinlock.c')
-rw-r--r-- | arch/s390/lib/spinlock.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index e41f4008afc5..f7e0d30250b7 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
@@ -124,6 +124,27 @@ void _raw_read_lock_wait(raw_rwlock_t *rw) | |||
124 | } | 124 | } |
125 | EXPORT_SYMBOL(_raw_read_lock_wait); | 125 | EXPORT_SYMBOL(_raw_read_lock_wait); |
126 | 126 | ||
127 | void _raw_read_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | ||
128 | { | ||
129 | unsigned int old; | ||
130 | int count = spin_retry; | ||
131 | |||
132 | local_irq_restore(flags); | ||
133 | while (1) { | ||
134 | if (count-- <= 0) { | ||
135 | _raw_yield(); | ||
136 | count = spin_retry; | ||
137 | } | ||
138 | if (!__raw_read_can_lock(rw)) | ||
139 | continue; | ||
140 | old = rw->lock & 0x7fffffffU; | ||
141 | local_irq_disable(); | ||
142 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) | ||
143 | return; | ||
144 | } | ||
145 | } | ||
146 | EXPORT_SYMBOL(_raw_read_lock_wait_flags); | ||
147 | |||
127 | int _raw_read_trylock_retry(raw_rwlock_t *rw) | 148 | int _raw_read_trylock_retry(raw_rwlock_t *rw) |
128 | { | 149 | { |
129 | unsigned int old; | 150 | unsigned int old; |
@@ -157,6 +178,25 @@ void _raw_write_lock_wait(raw_rwlock_t *rw) | |||
157 | } | 178 | } |
158 | EXPORT_SYMBOL(_raw_write_lock_wait); | 179 | EXPORT_SYMBOL(_raw_write_lock_wait); |
159 | 180 | ||
181 | void _raw_write_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | ||
182 | { | ||
183 | int count = spin_retry; | ||
184 | |||
185 | local_irq_restore(flags); | ||
186 | while (1) { | ||
187 | if (count-- <= 0) { | ||
188 | _raw_yield(); | ||
189 | count = spin_retry; | ||
190 | } | ||
191 | if (!__raw_write_can_lock(rw)) | ||
192 | continue; | ||
193 | local_irq_disable(); | ||
194 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) | ||
195 | return; | ||
196 | } | ||
197 | } | ||
198 | EXPORT_SYMBOL(_raw_write_lock_wait_flags); | ||
199 | |||
160 | int _raw_write_trylock_retry(raw_rwlock_t *rw) | 200 | int _raw_write_trylock_retry(raw_rwlock_t *rw) |
161 | { | 201 | { |
162 | int count = spin_retry; | 202 | int count = spin_retry; |