Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.12-rc7 43 lines 874 B view raw
1/* 2 * arch/alpha/lib/dec_and_lock.c 3 * 4 * ll/sc version of atomic_dec_and_lock() 5 * 6 */ 7 8#include <linux/spinlock.h> 9#include <linux/atomic.h> 10#include <linux/export.h> 11 12 asm (".text \n\ 13 .global _atomic_dec_and_lock \n\ 14 .ent _atomic_dec_and_lock \n\ 15 .align 4 \n\ 16_atomic_dec_and_lock: \n\ 17 .prologue 0 \n\ 181: ldl_l $1, 0($16) \n\ 19 subl $1, 1, $1 \n\ 20 beq $1, 2f \n\ 21 stl_c $1, 0($16) \n\ 22 beq $1, 4f \n\ 23 mb \n\ 24 clr $0 \n\ 25 ret \n\ 262: br $29, 3f \n\ 273: ldgp $29, 0($29) \n\ 28 br $atomic_dec_and_lock_1..ng \n\ 29 .subsection 2 \n\ 304: br 1b \n\ 31 .previous \n\ 32 .end _atomic_dec_and_lock"); 33 34static int __used atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock) 35{ 36 /* Slow path */ 37 spin_lock(lock); 38 if (atomic_dec_and_test(atomic)) 39 return 1; 40 spin_unlock(lock); 41 return 0; 42} 43EXPORT_SYMBOL(_atomic_dec_and_lock);