diff options
Diffstat (limited to 'arch/s390/include/asm/spinlock.h')
-rw-r--r-- | arch/s390/include/asm/spinlock.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h index df84ae96915..c9af0d19c7a 100644 --- a/arch/s390/include/asm/spinlock.h +++ b/arch/s390/include/asm/spinlock.h @@ -122,8 +122,10 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lp) #define __raw_write_can_lock(x) ((x)->lock == 0) extern void _raw_read_lock_wait(raw_rwlock_t *lp); +extern void _raw_read_lock_wait_flags(raw_rwlock_t *lp, unsigned long flags); extern int _raw_read_trylock_retry(raw_rwlock_t *lp); extern void _raw_write_lock_wait(raw_rwlock_t *lp); +extern void _raw_write_lock_wait_flags(raw_rwlock_t *lp, unsigned long flags); extern int _raw_write_trylock_retry(raw_rwlock_t *lp); static inline void __raw_read_lock(raw_rwlock_t *rw) @@ -134,6 +136,14 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) _raw_read_lock_wait(rw); } +static inline void __raw_read_lock_flags(raw_rwlock_t *rw, unsigned long flags) +{ + unsigned int old; + old = rw->lock & 0x7fffffffU; + if (_raw_compare_and_swap(&rw->lock, old, old + 1) != old) + _raw_read_lock_wait_flags(rw, flags); +} + static inline void __raw_read_unlock(raw_rwlock_t *rw) { unsigned int old, cmp; @@ -151,6 +161,12 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) _raw_write_lock_wait(rw); } +static inline void __raw_write_lock_flags(raw_rwlock_t *rw, unsigned long flags) +{ + if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) + _raw_write_lock_wait_flags(rw, flags); +} + static inline void __raw_write_unlock(raw_rwlock_t *rw) { _raw_compare_and_swap(&rw->lock, 0x80000000, 0); |