Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/asm/atomic.h
Context not available. | |||||
return (ret); | return (ret); | ||||
} | } | ||||
static inline int | |||||
atomic_dec_if_positive(atomic_t *v) { | |||||
int c, old, dec; | |||||
c = atomic_read(v); | |||||
for (;;) { | |||||
dec = c - 1; | |||||
if (unlikely(dec < 0)) | |||||
break; | |||||
old = atomic_cmpxchg((v), c, dec); | |||||
if (likely(old == c)) | |||||
break; | |||||
c = old; | |||||
} | |||||
return dec; | |||||
} | |||||
#define cmpxchg(ptr, old, new) ({ \ | #define cmpxchg(ptr, old, new) ({ \ | ||||
union { \ | union { \ | ||||
__typeof(*(ptr)) val; \ | __typeof(*(ptr)) val; \ | ||||
Context not available. |