Prev: [PATCH -next] staging: rtl8192* needs semaphore.h
Next: [PATCH 00/10] __rcu annotations, first draft
From: Arnd Bergmann on 24 Feb 2010 15:10 Signed-off-by: Arnd Bergmann <arnd(a)arndb.de> --- include/linux/notifier.h | 10 +++++----- kernel/notifier.c | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/linux/notifier.h b/include/linux/notifier.h index fee6c2f..f05f5e4 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -49,28 +49,28 @@ struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); - struct notifier_block *next; + struct notifier_block __rcu *next; int priority; }; struct atomic_notifier_head { spinlock_t lock; - struct notifier_block *head; + struct notifier_block __rcu *head; }; struct blocking_notifier_head { struct rw_semaphore rwsem; - struct notifier_block *head; + struct notifier_block __rcu *head; }; struct raw_notifier_head { - struct notifier_block *head; + struct notifier_block __rcu *head; }; struct srcu_notifier_head { struct mutex mutex; struct srcu_struct srcu; - struct notifier_block *head; + struct notifier_block __rcu *head; }; #define ATOMIC_INIT_NOTIFIER_HEAD(name) do { \ diff --git a/kernel/notifier.c b/kernel/notifier.c index acd24e7..c0e8489 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -18,43 +18,43 @@ BLOCKING_NOTIFIER_HEAD(reboot_notifier_list); * are layered on top of these, with appropriate locking added. */ -static int notifier_chain_register(struct notifier_block **nl, +static int notifier_chain_register(struct notifier_block __rcu **nl, struct notifier_block *n) { while ((*nl) != NULL) { - if (n->priority > (*nl)->priority) + if (n->priority > __rcu_dereference(*nl)->priority) break; - nl = &((*nl)->next); + nl = __rcu_dereference(&((*nl)->next)); } n->next = *nl; rcu_assign_pointer(*nl, n); return 0; } -static int notifier_chain_cond_register(struct notifier_block **nl, +static int notifier_chain_cond_register(struct notifier_block __rcu **nl, struct notifier_block *n) { while ((*nl) != NULL) { - if ((*nl) == n) + if (__rcu_dereference(*nl) == n) return 0; - if (n->priority > (*nl)->priority) + if (n->priority > __rcu_dereference(*nl)->priority) break; - nl = &((*nl)->next); + nl = __rcu_dereference(&((*nl)->next)); } n->next = *nl; rcu_assign_pointer(*nl, n); return 0; } -static int notifier_chain_unregister(struct notifier_block **nl, +static int notifier_chain_unregister(struct notifier_block __rcu **nl, struct notifier_block *n) { while ((*nl) != NULL) { - if ((*nl) == n) { + if (__rcu_dereference(*nl) == n) { rcu_assign_pointer(*nl, n->next); return 0; } - nl = &((*nl)->next); + nl = __rcu_dereference(&((*nl)->next)); } return -ENOENT; } @@ -71,7 +71,7 @@ static int notifier_chain_unregister(struct notifier_block **nl, * @returns: notifier_call_chain returns the value returned by the * last notifier function called. */ -static int __kprobes notifier_call_chain(struct notifier_block **nl, +static int __kprobes notifier_call_chain(struct notifier_block __rcu **nl, unsigned long val, void *v, int nr_to_call, int *nr_calls) { -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |