git: 6be89cc88d63 - main - linuxkpi: atomic: Add atomic_fetch_inc

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Mon, 08 Aug 2022 14:04:10 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=6be89cc88d63263b51bfb0271e2119cccbc86f16

commit 6be89cc88d63263b51bfb0271e2119cccbc86f16
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-07-26 08:00:42 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-08-08 13:22:34 +0000

    linuxkpi: atomic: Add atomic_fetch_inc
    
    Reviewed by:    hselasky
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D35936
---
 sys/compat/linuxkpi/common/include/asm/atomic.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/asm/atomic.h b/sys/compat/linuxkpi/common/include/asm/atomic.h
index 8c201ad6a101..7c7a2c4d4b92 100644
--- a/sys/compat/linuxkpi/common/include/asm/atomic.h
+++ b/sys/compat/linuxkpi/common/include/asm/atomic.h
@@ -307,6 +307,13 @@ static inline int atomic_fetch_##op(int i, atomic_t *v)		\
 	return (c);						\
 }
 
+static inline int
+atomic_fetch_inc(atomic_t *v)
+{
+
+	return ((atomic_inc_return(v) - 1));
+}
+
 LINUX_ATOMIC_OP(or, |)
 LINUX_ATOMIC_OP(and, &)
 LINUX_ATOMIC_OP(andnot, &~)