VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   35 Branches   59 Tags
author: Mark Rutland <mark.rutland@arm.com> 2018-09-04 11:48:25 +0100 committer: Ingo Molnar <mingo@kernel.org> 2018-11-01 11:00:36 +0100 commit: ace9bad4df2684f31cbfe8c4ce7a0f5d92b27925 parent: 01a14bda11add9dcd4a59200f13834d634559935
Commit Summary:
locking/atomics: Add common header generation files
Diffstat:
1 file changed, 13 insertions, 0 deletions
diff --git a/scripts/atomic/fallbacks/dec_if_positive b/scripts/atomic/fallbacks/dec_if_positive
new file mode 100644
index 000000000000..c52eacec43c8
--- /dev/null
+++ b/scripts/atomic/fallbacks/dec_if_positive
@@ -0,0 +1,15 @@
+cat <<EOF
+static inline ${ret}
+${atomic}_dec_if_positive(${atomic}_t *v)
+{
+	${int} dec, c = ${atomic}_read(v);
+
+	do {
+		dec = c - 1;
+		if (unlikely(dec < 0))
+			break;
+	} while (!${atomic}_try_cmpxchg(v, &c, dec));
+
+	return dec;
+}
+EOF