Lines Matching refs:rw
106 #define arch_read_relax(rw) barrier() argument
107 #define arch_write_relax(rw) barrier() argument
112 static inline void arch_read_lock(arch_rwlock_t *rw) in arch_read_lock() argument
116 old = __atomic_add(1, &rw->cnts); in arch_read_lock()
118 arch_read_lock_wait(rw); in arch_read_lock()
121 static inline void arch_read_unlock(arch_rwlock_t *rw) in arch_read_unlock() argument
123 __atomic_add_const_barrier(-1, &rw->cnts); in arch_read_unlock()
126 static inline void arch_write_lock(arch_rwlock_t *rw) in arch_write_lock() argument
128 if (!__atomic_cmpxchg_bool(&rw->cnts, 0, 0x30000)) in arch_write_lock()
129 arch_write_lock_wait(rw); in arch_write_lock()
132 static inline void arch_write_unlock(arch_rwlock_t *rw) in arch_write_unlock() argument
134 __atomic_add_barrier(-0x30000, &rw->cnts); in arch_write_unlock()
138 static inline int arch_read_trylock(arch_rwlock_t *rw) in arch_read_trylock() argument
142 old = READ_ONCE(rw->cnts); in arch_read_trylock()
144 __atomic_cmpxchg_bool(&rw->cnts, old, old + 1)); in arch_read_trylock()
147 static inline int arch_write_trylock(arch_rwlock_t *rw) in arch_write_trylock() argument
151 old = READ_ONCE(rw->cnts); in arch_write_trylock()
152 return !old && __atomic_cmpxchg_bool(&rw->cnts, 0, 0x30000); in arch_write_trylock()