diff options
Diffstat (limited to 'include/linux/kref.h')
-rw-r--r-- | include/linux/kref.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/kref.h b/include/linux/kref.h index 484604d184be..171f68a43d1d 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -25,6 +25,8 @@ struct kref { atomic_t refcount; }; +#define KREF_INIT(n) { .refcount = ATOMIC_INIT(n), } + /** * kref_init - initialize object. * @kref: object in question. @@ -34,6 +36,11 @@ static inline void kref_init(struct kref *kref) atomic_set(&kref->refcount, 1); } +static inline int kref_read(const struct kref *kref) +{ + return atomic_read(&kref->refcount); +} + /** * kref_get - increment refcount for object. * @kref: object. |