Lines Matching refs:kref
44 struct kref { struct
49 kref_init(struct kref *kref) in kref_init() argument
52 refcount_init(&kref->refcount.counter, 1); in kref_init()
56 kref_read(const struct kref *kref) in kref_read() argument
59 return (atomic_read(&kref->refcount)); in kref_read()
63 kref_get(struct kref *kref) in kref_get() argument
66 refcount_acquire(&kref->refcount.counter); in kref_get()
70 kref_put(struct kref *kref, void (*rel)(struct kref *kref)) in kref_put() argument
73 if (refcount_release(&kref->refcount.counter)) { in kref_put()
74 rel(kref); in kref_put()
81 kref_sub(struct kref *kref, unsigned int count, in kref_sub() argument
82 void (*rel)(struct kref *kref)) in kref_sub() argument
86 if (refcount_release(&kref->refcount.counter)) { in kref_sub()
87 rel(kref); in kref_sub()
95 kref_get_unless_zero(struct kref *kref) in kref_get_unless_zero() argument
98 return atomic_add_unless(&kref->refcount, 1, 0); in kref_get_unless_zero()
101 static inline int kref_put_mutex(struct kref *kref, in kref_put_mutex() argument
102 void (*release)(struct kref *kref), struct mutex *lock) in kref_put_mutex() argument
105 if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { in kref_put_mutex()
107 if (unlikely(!atomic_dec_and_test(&kref->refcount))) { in kref_put_mutex()
111 release(kref); in kref_put_mutex()