Lines Matching refs:sem

35 static inline void __down_read(struct rw_semaphore *sem)  in __down_read()  argument
37 if (unlikely(atomic_long_inc_return_acquire(&sem->count) <= 0)) in __down_read()
38 rwsem_down_read_failed(sem); in __down_read()
41 static inline int __down_read_killable(struct rw_semaphore *sem) in __down_read_killable() argument
43 if (unlikely(atomic_long_inc_return_acquire(&sem->count) <= 0)) { in __down_read_killable()
44 if (IS_ERR(rwsem_down_read_failed_killable(sem))) in __down_read_killable()
51 static inline int __down_read_trylock(struct rw_semaphore *sem) in __down_read_trylock() argument
55 while ((tmp = atomic_long_read(&sem->count)) >= 0) { in __down_read_trylock()
56 if (tmp == atomic_long_cmpxchg_acquire(&sem->count, tmp, in __down_read_trylock()
67 static inline void __down_write(struct rw_semaphore *sem) in __down_write() argument
72 &sem->count); in __down_write()
74 rwsem_down_write_failed(sem); in __down_write()
77 static inline int __down_write_killable(struct rw_semaphore *sem) in __down_write_killable() argument
82 &sem->count); in __down_write_killable()
84 if (IS_ERR(rwsem_down_write_failed_killable(sem))) in __down_write_killable()
89 static inline int __down_write_trylock(struct rw_semaphore *sem) in __down_write_trylock() argument
93 tmp = atomic_long_cmpxchg_acquire(&sem->count, RWSEM_UNLOCKED_VALUE, in __down_write_trylock()
101 static inline void __up_read(struct rw_semaphore *sem) in __up_read() argument
105 tmp = atomic_long_dec_return_release(&sem->count); in __up_read()
107 rwsem_wake(sem); in __up_read()
113 static inline void __up_write(struct rw_semaphore *sem) in __up_write() argument
116 &sem->count) < 0)) in __up_write()
117 rwsem_wake(sem); in __up_write()
123 static inline void __downgrade_write(struct rw_semaphore *sem) in __downgrade_write() argument
134 tmp = atomic_long_add_return_release(-RWSEM_WAITING_BIAS, &sem->count); in __downgrade_write()
136 rwsem_downgrade_wake(sem); in __downgrade_write()