Lines Matching refs:kref
21 struct kref { struct
31 static inline void kref_init(struct kref *kref) in kref_init() argument
33 refcount_set(&kref->refcount, 1); in kref_init()
36 static inline unsigned int kref_read(const struct kref *kref) in kref_read() argument
38 return refcount_read(&kref->refcount); in kref_read()
45 static inline void kref_get(struct kref *kref) in kref_get() argument
47 refcount_inc(&kref->refcount); in kref_get()
67 static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)) in kref_put() argument
69 if (refcount_dec_and_test(&kref->refcount)) { in kref_put()
70 release(kref); in kref_put()
76 static inline int kref_put_mutex(struct kref *kref, in kref_put_mutex() argument
77 void (*release)(struct kref *kref), in kref_put_mutex() argument
80 if (refcount_dec_and_mutex_lock(&kref->refcount, lock)) { in kref_put_mutex()
81 release(kref); in kref_put_mutex()
87 static inline int kref_put_lock(struct kref *kref, in kref_put_lock() argument
88 void (*release)(struct kref *kref), in kref_put_lock() argument
91 if (refcount_dec_and_lock(&kref->refcount, lock)) { in kref_put_lock()
92 release(kref); in kref_put_lock()
114 static inline int __must_check kref_get_unless_zero(struct kref *kref) in kref_get_unless_zero() argument
116 return refcount_inc_not_zero(&kref->refcount); in kref_get_unless_zero()