Staging
v0.8.1
https://github.com/torvalds/linux
Raw File
Tip revision: 9abf2313adc1ca1b6180c508c25f22f9395cc780 authored by Linus Torvalds on 16 October 2022, 22:36:24 UTC
Linux 6.1-rc1
Tip revision: 9abf231
dec_if_positive
cat <<EOF
static __always_inline ${ret}
arch_${atomic}_dec_if_positive(${atomic}_t *v)
{
	${int} dec, c = arch_${atomic}_read(v);

	do {
		dec = c - 1;
		if (unlikely(dec < 0))
			break;
	} while (!arch_${atomic}_try_cmpxchg(v, &c, dec));

	return dec;
}
EOF
back to top