Lines Matching refs:r
127 void refcount_warn_saturate(refcount_t *r, enum refcount_saturation_type t);
134 static inline void refcount_set(refcount_t *r, int n) in refcount_set() argument
136 atomic_set(&r->refs, n); in refcount_set()
145 static inline unsigned int refcount_read(const refcount_t *r) in refcount_read() argument
147 return atomic_read(&r->refs); in refcount_read()
150 static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp) in __refcount_add_not_zero() argument
152 int old = refcount_read(r); in __refcount_add_not_zero()
157 } while (!atomic_try_cmpxchg_relaxed(&r->refs, &old, old + i)); in __refcount_add_not_zero()
163 refcount_warn_saturate(r, REFCOUNT_ADD_NOT_ZERO_OVF); in __refcount_add_not_zero()
186 static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r) in refcount_add_not_zero() argument
188 return __refcount_add_not_zero(i, r, NULL); in refcount_add_not_zero()
191 static inline void __refcount_add(int i, refcount_t *r, int *oldp) in __refcount_add() argument
193 int old = atomic_fetch_add_relaxed(i, &r->refs); in __refcount_add()
199 refcount_warn_saturate(r, REFCOUNT_ADD_UAF); in __refcount_add()
201 refcount_warn_saturate(r, REFCOUNT_ADD_OVF); in __refcount_add()
220 static inline void refcount_add(int i, refcount_t *r) in refcount_add() argument
222 __refcount_add(i, r, NULL); in refcount_add()
225 static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp) in __refcount_inc_not_zero() argument
227 return __refcount_add_not_zero(1, r, oldp); in __refcount_inc_not_zero()
243 static inline __must_check bool refcount_inc_not_zero(refcount_t *r) in refcount_inc_not_zero() argument
245 return __refcount_inc_not_zero(r, NULL); in refcount_inc_not_zero()
248 static inline void __refcount_inc(refcount_t *r, int *oldp) in __refcount_inc() argument
250 __refcount_add(1, r, oldp); in __refcount_inc()
265 static inline void refcount_inc(refcount_t *r) in refcount_inc() argument
267 __refcount_inc(r, NULL); in refcount_inc()
270 static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp) in __refcount_sub_and_test() argument
272 int old = atomic_fetch_sub_release(i, &r->refs); in __refcount_sub_and_test()
283 refcount_warn_saturate(r, REFCOUNT_SUB_UAF); in __refcount_sub_and_test()
308 static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r) in refcount_sub_and_test() argument
310 return __refcount_sub_and_test(i, r, NULL); in refcount_sub_and_test()
313 static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp) in __refcount_dec_and_test() argument
315 return __refcount_sub_and_test(1, r, oldp); in __refcount_dec_and_test()
331 static inline __must_check bool refcount_dec_and_test(refcount_t *r) in refcount_dec_and_test() argument
333 return __refcount_dec_and_test(r, NULL); in refcount_dec_and_test()
336 static inline void __refcount_dec(refcount_t *r, int *oldp) in __refcount_dec() argument
338 int old = atomic_fetch_sub_release(1, &r->refs); in __refcount_dec()
344 refcount_warn_saturate(r, REFCOUNT_DEC_LEAK); in __refcount_dec()
357 static inline void refcount_dec(refcount_t *r) in refcount_dec() argument
359 __refcount_dec(r, NULL); in refcount_dec()
362 extern __must_check bool refcount_dec_if_one(refcount_t *r);
363 extern __must_check bool refcount_dec_not_one(refcount_t *r);
364 extern __must_check bool refcount_dec_and_mutex_lock(refcount_t *r, struct mutex *lock);
365 extern __must_check bool refcount_dec_and_lock(refcount_t *r, spinlock_t *lock);
366 extern __must_check bool refcount_dec_and_lock_irqsave(refcount_t *r,