Lines Matching refs:kref
19 struct kref { struct
29 static inline void kref_init(struct kref *kref) in kref_init() argument
31 refcount_set(&kref->refcount, 1); in kref_init()
34 static inline unsigned int kref_read(const struct kref *kref) in kref_read() argument
36 return refcount_read(&kref->refcount); in kref_read()
43 static inline void kref_get(struct kref *kref) in kref_get() argument
45 refcount_inc(&kref->refcount); in kref_get()
62 static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)) in kref_put() argument
64 if (refcount_dec_and_test(&kref->refcount)) { in kref_put()
65 release(kref); in kref_put()
71 static inline int kref_put_mutex(struct kref *kref, in kref_put_mutex() argument
72 void (*release)(struct kref *kref), in kref_put_mutex() argument
75 if (refcount_dec_and_mutex_lock(&kref->refcount, lock)) { in kref_put_mutex()
76 release(kref); in kref_put_mutex()
82 static inline int kref_put_lock(struct kref *kref, in kref_put_lock() argument
83 void (*release)(struct kref *kref), in kref_put_lock() argument
86 if (refcount_dec_and_lock(&kref->refcount, lock)) { in kref_put_lock()
87 release(kref); in kref_put_lock()
109 static inline int __must_check kref_get_unless_zero(struct kref *kref) in kref_get_unless_zero() argument
111 return refcount_inc_not_zero(&kref->refcount); in kref_get_unless_zero()