[PATCH] (5/5) improved notifier callback mechanism -- remove old

Stephen Hemminger (shemminger@osdl.org)
19 Dec 2002 15:09:33 -0800


After the previous patches, the notifier interface now has it's own
locking. Therefore the existing locking done by the oprofile interface
is superfluous.
diff -Nru a/arch/i386/kernel/profile.c b/arch/i386/kernel/profile.c
--- a/arch/i386/kernel/profile.c Tue Dec 17 11:25:47 2002
+++ b/arch/i386/kernel/profile.c Tue Dec 17 11:25:47 2002
@@ -6,40 +6,25 @@
*/

#include <linux/profile.h>
-#include <linux/spinlock.h>
#include <linux/notifier.h>
#include <linux/irq.h>
#include <asm/hw_irq.h>

static LIST_HEAD(profile_listeners);
-static rwlock_t profile_lock = RW_LOCK_UNLOCKED;

int register_profile_notifier(struct notifier_block * nb)
{
- int err;
- write_lock_irq(&profile_lock);
- err = notifier_chain_register(&profile_listeners, nb);
- write_unlock_irq(&profile_lock);
- return err;
+ return notifier_chain_register(&profile_listeners, nb);
}


int unregister_profile_notifier(struct notifier_block * nb)
{
- int err;
- write_lock_irq(&profile_lock);
- err = notifier_chain_unregister(&profile_listeners, nb);
- write_unlock_irq(&profile_lock);
- return err;
+ return notifier_chain_unregister(&profile_listeners, nb);
}


void x86_profile_hook(struct pt_regs * regs)
{
- /* we would not even need this lock if
- * we had a global cli() on register/unregister
- */
- read_lock(&profile_lock);
notifier_call_chain(&profile_listeners, 0, regs);
- read_unlock(&profile_lock);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/