]> err.no Git - linux-2.6/blobdiff - lib/klist.c
[PATCH] ARM: Remove nmi_tick from integrator platforms
[linux-2.6] / lib / klist.c
index 6f760424648bf320eef69d6baa171af0c4e31c6b..738ab810160a85b1c437da82e0389d354c76cf20 100644 (file)
@@ -112,6 +112,7 @@ static void klist_release(struct kref * kref)
        struct klist_node * n = container_of(kref, struct klist_node, n_ref);
        list_del(&n->n_node);
        complete(&n->n_removed);
+       n->n_klist = NULL;
 }
 
 static int klist_dec_and_del(struct klist_node * n)
@@ -144,15 +145,29 @@ EXPORT_SYMBOL_GPL(klist_del);
 
 void klist_remove(struct klist_node * n)
 {
-       spin_lock(&n->n_klist->k_lock);
+       struct klist * k = n->n_klist;
+       spin_lock(&k->k_lock);
        klist_dec_and_del(n);
-       spin_unlock(&n->n_klist->k_lock);
+       spin_unlock(&k->k_lock);
        wait_for_completion(&n->n_removed);
 }
 
 EXPORT_SYMBOL_GPL(klist_remove);
 
 
+/**
+ *     klist_node_attached - Say whether a node is bound to a list or not.
+ *     @n:     Node that we're testing.
+ */
+
+int klist_node_attached(struct klist_node * n)
+{
+       return (n->n_klist != NULL);
+}
+
+EXPORT_SYMBOL_GPL(klist_node_attached);
+
+
 /**
  *     klist_iter_init_node - Initialize a klist_iter structure.
  *     @k:     klist we're iterating.
@@ -246,3 +261,5 @@ struct klist_node * klist_next(struct klist_iter * i)
 }
 
 EXPORT_SYMBOL_GPL(klist_next);
+
+