aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-06-12 23:43:06 -0400
committerTejun Heo <tj@kernel.org>2013-06-12 23:43:06 -0400
commitac899061a93250c28562f05ad94d5c74603415bc (patch)
tree26acc69d4b0f509b2ee0693d3fd7b0fd12232059
parent6a24474da83ea7c8b7d32f05f858b1259994067a (diff)
percpu-refcount: cosmetic updates
* s/percpu_ref_release/percpu_ref_func_t/ as it's customary to have _t postfix for types and the type is gonna be used for a different type of callback too. * Add @ARG to function comments. * Drop unnecessary and unaligned indentation from percpu_ref_init() function comment. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Kent Overstreet <koverstreet@google.com>
-rw-r--r--include/linux/percpu-refcount.h8
-rw-r--r--lib/percpu-refcount.c7
2 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index abe141172d96..b61bd6f23985 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -51,7 +51,7 @@
51#include <linux/rcupdate.h> 51#include <linux/rcupdate.h>
52 52
53struct percpu_ref; 53struct percpu_ref;
54typedef void (percpu_ref_release)(struct percpu_ref *); 54typedef void (percpu_ref_func_t)(struct percpu_ref *);
55 55
56struct percpu_ref { 56struct percpu_ref {
57 atomic_t count; 57 atomic_t count;
@@ -62,11 +62,11 @@ struct percpu_ref {
62 * percpu_ref_kill_rcu()) 62 * percpu_ref_kill_rcu())
63 */ 63 */
64 unsigned __percpu *pcpu_count; 64 unsigned __percpu *pcpu_count;
65 percpu_ref_release *release; 65 percpu_ref_func_t *release;
66 struct rcu_head rcu; 66 struct rcu_head rcu;
67}; 67};
68 68
69int percpu_ref_init(struct percpu_ref *, percpu_ref_release *); 69int percpu_ref_init(struct percpu_ref *ref, percpu_ref_func_t *release);
70void percpu_ref_kill(struct percpu_ref *ref); 70void percpu_ref_kill(struct percpu_ref *ref);
71 71
72#define PCPU_STATUS_BITS 2 72#define PCPU_STATUS_BITS 2
@@ -78,6 +78,7 @@ void percpu_ref_kill(struct percpu_ref *ref);
78 78
79/** 79/**
80 * percpu_ref_get - increment a percpu refcount 80 * percpu_ref_get - increment a percpu refcount
81 * @ref: percpu_ref to get
81 * 82 *
82 * Analagous to atomic_inc(). 83 * Analagous to atomic_inc().
83 */ 84 */
@@ -99,6 +100,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
99 100
100/** 101/**
101 * percpu_ref_put - decrement a percpu refcount 102 * percpu_ref_put - decrement a percpu refcount
103 * @ref: percpu_ref to put
102 * 104 *
103 * Decrement the refcount, and if 0, call the release function (which was passed 105 * Decrement the refcount, and if 0, call the release function (which was passed
104 * to percpu_ref_init()) 106 * to percpu_ref_init())
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
index 1a17399fc7db..9a78e55fa48f 100644
--- a/lib/percpu-refcount.c
+++ b/lib/percpu-refcount.c
@@ -33,8 +33,8 @@
33 33
34/** 34/**
35 * percpu_ref_init - initialize a percpu refcount 35 * percpu_ref_init - initialize a percpu refcount
36 * @ref: ref to initialize 36 * @ref: percpu_ref to initialize
37 * @release: function which will be called when refcount hits 0 37 * @release: function which will be called when refcount hits 0
38 * 38 *
39 * Initializes the refcount in single atomic counter mode with a refcount of 1; 39 * Initializes the refcount in single atomic counter mode with a refcount of 1;
40 * analagous to atomic_set(ref, 1). 40 * analagous to atomic_set(ref, 1).
@@ -42,7 +42,7 @@
42 * Note that @release must not sleep - it may potentially be called from RCU 42 * Note that @release must not sleep - it may potentially be called from RCU
43 * callback context by percpu_ref_kill(). 43 * callback context by percpu_ref_kill().
44 */ 44 */
45int percpu_ref_init(struct percpu_ref *ref, percpu_ref_release *release) 45int percpu_ref_init(struct percpu_ref *ref, percpu_ref_func_t *release)
46{ 46{
47 atomic_set(&ref->count, 1 + PCPU_COUNT_BIAS); 47 atomic_set(&ref->count, 1 + PCPU_COUNT_BIAS);
48 48
@@ -98,6 +98,7 @@ static void percpu_ref_kill_rcu(struct rcu_head *rcu)
98 98
99/** 99/**
100 * percpu_ref_kill - safely drop initial ref 100 * percpu_ref_kill - safely drop initial ref
101 * @ref: percpu_ref to kill
101 * 102 *
102 * Must be used to drop the initial ref on a percpu refcount; must be called 103 * Must be used to drop the initial ref on a percpu refcount; must be called
103 * precisely once before shutdown. 104 * precisely once before shutdown.