diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-21 22:30:42 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-21 22:30:42 -0400 |
| commit | 08217637fe8a0ba24e1bfc893569f9be4d836c6a (patch) | |
| tree | aecd53ca7952b59d93f066161b677926e813a550 /arch/ia64/lib/dec_and_lock.c | |
| parent | 793b883ed12a6ae6e2901ddb5e038b77d6f0c0ac (diff) | |
| parent | efb0372bbaf5b829ff8c39db372779928af542a7 (diff) | |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'arch/ia64/lib/dec_and_lock.c')
| -rw-r--r-- | arch/ia64/lib/dec_and_lock.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/arch/ia64/lib/dec_and_lock.c b/arch/ia64/lib/dec_and_lock.c deleted file mode 100644 index c7ce92f968f1..000000000000 --- a/arch/ia64/lib/dec_and_lock.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2003 Jerome Marchand, Bull S.A. - * Cleaned up by David Mosberger-Tang <davidm@hpl.hp.com> - * - * This file is released under the GPLv2, or at your option any later version. - * - * ia64 version of "atomic_dec_and_lock()" using the atomic "cmpxchg" instruction. This - * code is an adaptation of the x86 version of "atomic_dec_and_lock()". - */ - -#include <linux/compiler.h> -#include <linux/module.h> -#include <linux/spinlock.h> -#include <asm/atomic.h> - -/* - * Decrement REFCOUNT and if the count reaches zero, acquire the spinlock. Both of these - * operations have to be done atomically, so that the count doesn't drop to zero without - * acquiring the spinlock first. - */ -int -_atomic_dec_and_lock (atomic_t *refcount, spinlock_t *lock) -{ - int old, new; - - do { - old = atomic_read(refcount); - new = old - 1; - - if (unlikely (old == 1)) { - /* oops, we may be decrementing to zero, do it the slow way... */ - spin_lock(lock); - if (atomic_dec_and_test(refcount)) - return 1; - spin_unlock(lock); - return 0; - } - } while (cmpxchg(&refcount->counter, old, new) != old); - return 0; -} - -EXPORT_SYMBOL(_atomic_dec_and_lock); |
