git: 1889bed23deb - main - linuxkpi: Add atomic64_fetch_add
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Feb 2022 08:43:24 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=1889bed23debb2029970c0f8e79db6b622c3cb09
commit 1889bed23debb2029970c0f8e79db6b622c3cb09
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-02-16 09:44:55 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-02-17 08:31:39 +0000
linuxkpi: Add atomic64_fetch_add
Linux variant of atomic_fetchadd_64.
Reviewed by: bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34296
---
sys/compat/linuxkpi/common/include/asm/atomic64.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/asm/atomic64.h b/sys/compat/linuxkpi/common/include/asm/atomic64.h
index b53063620bb2..4ee0fa5ecf84 100644
--- a/sys/compat/linuxkpi/common/include/asm/atomic64.h
+++ b/sys/compat/linuxkpi/common/include/asm/atomic64.h
@@ -52,6 +52,12 @@ typedef struct {
#define atomic64_dec_return(v) atomic64_sub_return(1, (v))
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
+static inline int64_t
+atomic64_fetch_add(int64_t i, atomic64_t *v)
+{
+ return (atomic_fetchadd_64(&v->counter, i));
+}
+
static inline int64_t
atomic64_add_return(int64_t i, atomic64_t *v)
{