git: efe7f12cd37b - main - linuxkpi: Implement rcu_replace_pointer() macro

Neel Chauhan nc at FreeBSD.org
Wed Apr 28 15:06:07 UTC 2021


The branch main has been updated by nc (ports committer):

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

commit efe7f12cd37bf8f2538df387d565e7849112a598
Author:     Neel Chauhan <nc at FreeBSD.org>
AuthorDate: 2021-04-28 15:04:52 +0000
Commit:     Neel Chauhan <nc at FreeBSD.org>
CommitDate: 2021-04-28 15:04:52 +0000

    linuxkpi: Implement rcu_replace_pointer() macro
    
    This is needed for the drm-kmod 5.5 update.
    
    Reviewed by:            hselasky (src)
    MFC after:              3 days
    Differential Revision:  https://reviews.freebsd.org/D30025
---
 sys/compat/linuxkpi/common/include/linux/rcupdate.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/rcupdate.h b/sys/compat/linuxkpi/common/include/linux/rcupdate.h
index a43736e0285f..ea97fecee53b 100644
--- a/sys/compat/linuxkpi/common/include/linux/rcupdate.h
+++ b/sys/compat/linuxkpi/common/include/linux/rcupdate.h
@@ -97,6 +97,13 @@
 	    (uintptr_t)(v));					\
 } while (0)
 
+#define	rcu_replace_pointer(rcu, ptr, c)			\
+({								\
+	typeof(ptr) __tmp = rcu_dereference_protected(rcu, c);	\
+	rcu_assign_pointer(rcu, ptr);				\
+	__tmp;							\
+})
+
 #define	rcu_swap_protected(rcu, ptr, c) do {			\
 	typeof(ptr) p = rcu_dereference_protected(rcu, c);	\
 	rcu_assign_pointer(rcu, ptr);				\


More information about the dev-commits-src-all mailing list