diff options
author | Tony Luck <tony.luck@intel.com> | 2005-09-08 14:27:13 -0700 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-09-08 14:27:13 -0700 |
commit | 344a076110f4ecb16ea6d286b63be696604982ed (patch) | |
tree | def6e229efdb6ee91b631b6695bf7f9ace8e2719 /lib/klist.c | |
parent | 9b17e7e74e767d8a494a74c3c459aeecd1e08c5f (diff) | |
parent | 1b11d78cf87a7014f96e5b7fa2e1233cc8081a00 (diff) | |
download | op-kernel-dev-344a076110f4ecb16ea6d286b63be696604982ed.zip op-kernel-dev-344a076110f4ecb16ea6d286b63be696604982ed.tar.gz |
[IA64] Manual merge fix for 3 files
arch/ia64/Kconfig
arch/ia64/kernel/acpi.c
include/asm-ia64/irq.h
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'lib/klist.c')
-rw-r--r-- | lib/klist.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/klist.c b/lib/klist.c index a70c836..bb2f355 100644 --- a/lib/klist.c +++ b/lib/klist.c @@ -42,12 +42,23 @@ /** * klist_init - Initialize a klist structure. * @k: The klist we're initializing. + * @get: The get function for the embedding object (NULL if none) + * @put: The put function for the embedding object (NULL if none) + * + * Initialises the klist structure. If the klist_node structures are + * going to be embedded in refcounted objects (necessary for safe + * deletion) then the get/put arguments are used to initialise + * functions that take and release references on the embedding + * objects. */ -void klist_init(struct klist * k) +void klist_init(struct klist * k, void (*get)(struct klist_node *), + void (*put)(struct klist_node *)) { INIT_LIST_HEAD(&k->k_list); spin_lock_init(&k->k_lock); + k->get = get; + k->put = put; } EXPORT_SYMBOL_GPL(klist_init); @@ -74,6 +85,8 @@ static void klist_node_init(struct klist * k, struct klist_node * n) init_completion(&n->n_removed); kref_init(&n->n_ref); n->n_klist = k; + if (k->get) + k->get(n); } @@ -110,9 +123,12 @@ EXPORT_SYMBOL_GPL(klist_add_tail); static void klist_release(struct kref * kref) { struct klist_node * n = container_of(kref, struct klist_node, n_ref); + void (*put)(struct klist_node *) = n->n_klist->put; list_del(&n->n_node); complete(&n->n_removed); n->n_klist = NULL; + if (put) + put(n); } static int klist_dec_and_del(struct klist_node * n) |