Skip to contentSkip to conversation

ia64-implement-atomic64_dec_if_positive.patch removed from -mm tree

merged [email protected] 1 participant 1 message Oct 10, 2016

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: ia64: implement atomic64_dec_if_positive
has been removed from the -mm tree. Its filename was
ia64-implement-atomic64_dec_if_positive.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Vineet Gupta <[email protected]>
Subject: ia64: implement atomic64_dec_if_positive

This is based on s390 version and needed to get rid of CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE

---

 arch/ia64/include/asm/atomic.h |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/ia64/include/asm/atomic.h renamed from arch/ia64/include/asm/atomic.h~ia64-implement-atomic64_dec_if_positive +16 -0
diff -puN arch/ia64/include/asm/atomic.h~ia64-implement-atomic64_dec_if_positive arch/ia64/include/asm/atomic.h
@@ -269,6 +269,22 @@ static __inline__ long atomic64_add_unle
 
 #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
 
+static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
+{
+	long c, old, dec;
+	c = atomic64_read(v);
+	for (;;) {
+		dec = c - 1;
+		if (unlikely(dec < 0))
+			break;
+		old = atomic64_cmpxchg((v), c, dec);
+		if (likely(old == c))
+			break;
+		c = old;
+	}
+	return dec;
+}
+
 /*
  * Atomically add I to V and return TRUE if the resulting value is
  * negative.

_

Patches currently in -mm which might be from [email protected] are