aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/klist.h2
-rw-r--r--lib/klist.c16
2 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/klist.h b/include/linux/klist.h
index fb52f9d9d611..eebf5e5696ec 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -37,6 +37,8 @@ extern void klist_add_head(struct klist * k, struct klist_node * n);
37extern void klist_del(struct klist_node * n); 37extern void klist_del(struct klist_node * n);
38extern void klist_remove(struct klist_node * n); 38extern void klist_remove(struct klist_node * n);
39 39
40extern int klist_node_attached(struct klist_node * n);
41
40 42
41struct klist_iter { 43struct klist_iter {
42 struct klist * i_klist; 44 struct klist * i_klist;
diff --git a/lib/klist.c b/lib/klist.c
index 6f760424648b..02177d72dc89 100644
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -112,6 +112,7 @@ static void klist_release(struct kref * kref)
112 struct klist_node * n = container_of(kref, struct klist_node, n_ref); 112 struct klist_node * n = container_of(kref, struct klist_node, n_ref);
113 list_del(&n->n_node); 113 list_del(&n->n_node);
114 complete(&n->n_removed); 114 complete(&n->n_removed);
115 n->n_klist = NULL;
115} 116}
116 117
117static int klist_dec_and_del(struct klist_node * n) 118static int klist_dec_and_del(struct klist_node * n)
@@ -154,6 +155,19 @@ EXPORT_SYMBOL_GPL(klist_remove);
154 155
155 156
156/** 157/**
158 * klist_node_attached - Say whether a node is bound to a list or not.
159 * @n: Node that we're testing.
160 */
161
162int klist_node_attached(struct klist_node * n)
163{
164 return (n->n_klist != NULL);
165}
166
167EXPORT_SYMBOL_GPL(klist_node_attached);
168
169
170/**
157 * klist_iter_init_node - Initialize a klist_iter structure. 171 * klist_iter_init_node - Initialize a klist_iter structure.
158 * @k: klist we're iterating. 172 * @k: klist we're iterating.
159 * @i: klist_iter we're filling. 173 * @i: klist_iter we're filling.
@@ -246,3 +260,5 @@ struct klist_node * klist_next(struct klist_iter * i)
246} 260}
247 261
248EXPORT_SYMBOL_GPL(klist_next); 262EXPORT_SYMBOL_GPL(klist_next);
263
264