* arch/s390/lib/spinlock.c
* Out of line spinlock code.
*
- * S390 version
- * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ * Copyright (C) IBM Corp. 2004, 2006
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
*/
_diag44();
count = spin_retry;
}
+ if (__raw_spin_is_locked(lp))
+ continue;
if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
return;
}
int count = spin_retry;
while (count-- > 0) {
+ if (__raw_spin_is_locked(lp))
+ continue;
if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
return 1;
}
_diag44();
count = spin_retry;
}
+ if (!__raw_read_can_lock(rw))
+ continue;
old = rw->lock & 0x7fffffffU;
if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
return;
int count = spin_retry;
while (count-- > 0) {
+ if (!__raw_read_can_lock(rw))
+ continue;
old = rw->lock & 0x7fffffffU;
if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
return 1;
_diag44();
count = spin_retry;
}
+ if (!__raw_write_can_lock(rw))
+ continue;
if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
return;
}
int count = spin_retry;
while (count-- > 0) {
+ if (!__raw_write_can_lock(rw))
+ continue;
if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
return 1;
}