Lines Matching refs:sem
34 static inline void __down_read(struct rw_semaphore *sem)
36 if (unlikely(atomic_long_inc_return((atomic_long_t *)&sem->count) <= 0))
37 rwsem_down_read_failed(sem);
40 static inline int __down_read_trylock(struct rw_semaphore *sem)
44 while ((tmp = sem->count) >= 0) {
45 if (tmp == cmpxchg(&sem->count, tmp,
56 static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
61 (atomic_long_t *)&sem->count);
63 rwsem_down_write_failed(sem);
66 static inline void __down_write(struct rw_semaphore *sem)
68 __down_write_nested(sem, 0);
71 static inline int __down_write_trylock(struct rw_semaphore *sem)
75 tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE,
83 static inline void __up_read(struct rw_semaphore *sem)
87 tmp = atomic_long_dec_return((atomic_long_t *)&sem->count);
89 rwsem_wake(sem);
95 static inline void __up_write(struct rw_semaphore *sem)
98 (atomic_long_t *)&sem->count) < 0))
99 rwsem_wake(sem);
105 static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
107 atomic_long_add(delta, (atomic_long_t *)&sem->count);
113 static inline void __downgrade_write(struct rw_semaphore *sem)
118 (atomic_long_t *)&sem->count);
120 rwsem_downgrade_wake(sem);
126 static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
128 return atomic_long_add_return(delta, (atomic_long_t *)&sem->count);