Lines Matching refs:kref
45 struct kref { struct
50 kref_init(struct kref *kref) in kref_init() argument
53 refcount_init(&kref->refcount.counter, 1); in kref_init()
57 kref_read(const struct kref *kref) in kref_read() argument
60 return (atomic_read(&kref->refcount)); in kref_read()
64 kref_get(struct kref *kref) in kref_get() argument
67 refcount_acquire(&kref->refcount.counter); in kref_get()
71 kref_put(struct kref *kref, void (*rel)(struct kref *kref)) in kref_put() argument
74 if (refcount_release(&kref->refcount.counter)) { in kref_put()
75 rel(kref); in kref_put()
82 kref_put_lock(struct kref *kref, void (*rel)(struct kref *kref), in kref_put_lock() argument
86 if (refcount_release(&kref->refcount.counter)) { in kref_put_lock()
88 rel(kref); in kref_put_lock()
95 kref_sub(struct kref *kref, unsigned int count, in kref_sub() argument
96 void (*rel)(struct kref *kref)) in kref_sub() argument
100 if (refcount_release(&kref->refcount.counter)) { in kref_sub()
101 rel(kref); in kref_sub()
109 kref_get_unless_zero(struct kref *kref) in kref_get_unless_zero() argument
112 return atomic_add_unless(&kref->refcount, 1, 0); in kref_get_unless_zero()
115 static inline int kref_put_mutex(struct kref *kref, in kref_put_mutex() argument
116 void (*release)(struct kref *kref), struct mutex *lock) in kref_put_mutex() argument
119 if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { in kref_put_mutex()
121 if (unlikely(!atomic_dec_and_test(&kref->refcount))) { in kref_put_mutex()
125 release(kref); in kref_put_mutex()