Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Feb 2023 11:56:23 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 313d438a20d1 - stable/13 - linuxkpi: Define `xa_is_err()`, `xa_{store,erase}_irq()` and `xa_{,un}lock_irq*()`
Message-ID:  <202302161156.31GBuNXN056085@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=313d438a20d1e9ed527f0a8ac095f81b8ba43250

commit 313d438a20d1e9ed527f0a8ac095f81b8ba43250
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-02-08 17:55:29 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-16 11:55:19 +0000

    linuxkpi: Define `xa_is_err()`, `xa_{store,erase}_irq()` and `xa_{,un}lock_irq*()`
    
    `xa_is_err()` is synonymous to `IS_ERR()`.
    
    Other introduced functions call their equivalent without the `irq*`
    suffix.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38534
    
    (cherry picked from commit 5542309ec6eba3af9e26c50acd654de462181b8e)
---
 sys/compat/linuxkpi/common/include/linux/xarray.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/xarray.h b/sys/compat/linuxkpi/common/include/linux/xarray.h
index 408906867479..8a9d8fa3ea41 100644
--- a/sys/compat/linuxkpi/common/include/linux/xarray.h
+++ b/sys/compat/linuxkpi/common/include/linux/xarray.h
@@ -45,6 +45,9 @@
 #define	XA_ERROR(x) \
 	ERR_PTR(x)
 
+#define	xa_is_err(x) \
+	IS_ERR(x)
+
 #define	xa_limit_32b XA_LIMIT(0, 0xFFFFFFFF)
 
 #define	XA_ASSERT_LOCKED(xa) mtx_assert(&(xa)->mtx, MA_OWNED)
@@ -87,6 +90,24 @@ void *__xa_store(struct xarray *, uint32_t, void *, gfp_t);
 bool __xa_empty(struct xarray *);
 void *__xa_next(struct xarray *, unsigned long *, bool);
 
+#define	xa_store_irq(xa, index, ptr, gfp) \
+	xa_store((xa), (index), (ptr), (gfp))
+
+#define	xa_erase_irq(xa, index) \
+	xa_erase((xa), (index))
+
+#define	xa_lock_irqsave(xa, flags) \
+	do { \
+		xa_lock((xa)); \
+		flags = 0; \
+	} while (0)
+
+#define	xa_unlock_irqrestore(xa, flags) \
+	do { \
+		xa_unlock((xa)); \
+		flags == 0; \
+	} while (0)
+
 static inline int
 xa_err(void *ptr)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302161156.31GBuNXN056085>