diff mbox series

[3/6] backport: add atomic_fetch_add_unless()

Message ID 20190315143318.4714-4-luca@coelho.fi (mailing list archive)
State Accepted
Headers show
Series backport: some patches from our internal tree 2019-03-15 | expand

Commit Message

Luca Coelho March 15, 2019, 2:33 p.m. UTC
From: Luca Coelho <luciano.coelho@intel.com>

The iwlwifi driver now needs this function.  Backport it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 backport/backport-include/linux/atomic.h | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/atomic.h b/backport/backport-include/linux/atomic.h
index b4dd2e1d34f0..9ceb586e864a 100644
--- a/backport/backport-include/linux/atomic.h
+++ b/backport/backport-include/linux/atomic.h
@@ -51,4 +51,13 @@ 
 
 #endif /* atomic_try_cmpxchg_acquire */
 
+#if LINUX_VERSION_IS_LESS(4,19,0)
+#ifndef atomic_fetch_add_unless
+static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
+{
+	return __atomic_add_unless(v, a, u);
+}
+#endif
+#endif
+
 #endif /* __BP_ATOMIC_H */