git: ec504d3049a0 - stable/13 - linuxkpi: Add atomic64_fetch_add
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 05 Mar 2022 11:34:22 UTC
The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=ec504d3049a06483ee441ef64318623caf7a5975 commit ec504d3049a06483ee441ef64318623caf7a5975 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2022-02-16 09:44:55 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2022-03-05 11:12:44 +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 (cherry picked from commit 1889bed23debb2029970c0f8e79db6b622c3cb09) --- 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) {