https://github.com/torvalds/linux
Revision 6882edc04f37691ff9c7fcb30b52506cd7697eb0 authored by Robin Holt on 08 December 2008, 14:43:46 UTC, committed by Tony Luck on 09 December 2008, 18:08:39 UTC
The generic_defconfig has three section mismatches.  This clears up
sn_check_wars().

Signed-off-by: Robin Holt <holt@sgi.com>
Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
1 parent 9877e7b
Raw File
Tip revision: 6882edc04f37691ff9c7fcb30b52506cd7697eb0 authored by Robin Holt on 08 December 2008, 14:43:46 UTC
[IA64] Clear up section mismatch for sn_check_wars.
Tip revision: 6882edc
dec_and_lock.c
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>

/*
 * This is an implementation of the notion of "decrement a
 * reference count, and return locked if it decremented to zero".
 *
 * NOTE NOTE NOTE! This is _not_ equivalent to
 *
 *	if (atomic_dec_and_test(&atomic)) {
 *		spin_lock(&lock);
 *		return 1;
 *	}
 *	return 0;
 *
 * because the spin-lock and the decrement must be
 * "atomic".
 */
int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
{
#ifdef CONFIG_SMP
	/* Subtract 1 from counter unless that drops it to 0 (ie. it was 1) */
	if (atomic_add_unless(atomic, -1, 1))
		return 0;
#endif
	/* Otherwise do it the slow way */
	spin_lock(lock);
	if (atomic_dec_and_test(atomic))
		return 1;
	spin_unlock(lock);
	return 0;
}

EXPORT_SYMBOL(_atomic_dec_and_lock);
back to top