aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kref.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kref.c')
-rw-r--r--lib/kref.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/lib/kref.c b/lib/kref.c
index 6d19f690380b..d3d227a08a4b 100644
--- a/lib/kref.c
+++ b/lib/kref.c
@@ -16,23 +16,13 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17 17
18/** 18/**
19 * kref_set - initialize object and set refcount to requested number.
20 * @kref: object in question.
21 * @num: initial reference counter
22 */
23void kref_set(struct kref *kref, int num)
24{
25 atomic_set(&kref->refcount, num);
26 smp_mb();
27}
28
29/**
30 * kref_init - initialize object. 19 * kref_init - initialize object.
31 * @kref: object in question. 20 * @kref: object in question.
32 */ 21 */
33void kref_init(struct kref *kref) 22void kref_init(struct kref *kref)
34{ 23{
35 kref_set(kref, 1); 24 atomic_set(&kref->refcount, 1);
25 smp_mb();
36} 26}
37 27
38/** 28/**
@@ -72,7 +62,6 @@ int kref_put(struct kref *kref, void (*release)(struct kref *kref))
72 return 0; 62 return 0;
73} 63}
74 64
75EXPORT_SYMBOL(kref_set);
76EXPORT_SYMBOL(kref_init); 65EXPORT_SYMBOL(kref_init);
77EXPORT_SYMBOL(kref_get); 66EXPORT_SYMBOL(kref_get);
78EXPORT_SYMBOL(kref_put); 67EXPORT_SYMBOL(kref_put);