Lines Matching refs:kref
22 struct kref { struct
30 static inline void kref_init(struct kref *kref) in kref_init() argument
32 atomic_set(&kref->refcount, 1); in kref_init()
39 static inline void kref_get(struct kref *kref) in kref_get() argument
41 WARN_ON(!atomic_read(&kref->refcount)); in kref_get()
42 atomic_inc(&kref->refcount); in kref_get()
63 static inline int kref_sub(struct kref *kref, unsigned int count, in kref_sub() argument
64 void (*release)(struct kref *kref)) in kref_sub() argument
68 if (atomic_sub_and_test((int) count, &kref->refcount)) { in kref_sub()
69 release(kref); in kref_sub()
92 static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)) in kref_put() argument
94 return kref_sub(kref, 1, release); in kref_put()
113 static inline int __must_check kref_get_unless_zero(struct kref *kref) in kref_get_unless_zero() argument
115 return atomic_add_unless(&kref->refcount, 1, 0); in kref_get_unless_zero()