Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/include/linux Replace ACCESS_ONCE by...



details:   https://anonhg.NetBSD.org/src/rev/c2512197522c
branches:  trunk
changeset: 1027812:c2512197522c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 00:48:23 2021 +0000

description:
Replace ACCESS_ONCE by READ_ONCE, WRITE_ONCE.

diffstat:

 sys/external/bsd/common/include/linux/compiler.h |  16 +++++++++++++++-
 sys/external/bsd/common/include/linux/kernel.h   |   8 +-------
 2 files changed, 16 insertions(+), 8 deletions(-)

diffs (50 lines):

diff -r e87810e9e3fd -r c2512197522c sys/external/bsd/common/include/linux/compiler.h
--- a/sys/external/bsd/common/include/linux/compiler.h  Sun Dec 19 00:48:16 2021 +0000
+++ b/sys/external/bsd/common/include/linux/compiler.h  Sun Dec 19 00:48:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compiler.h,v 1.1 2021/12/19 00:45:28 riastradh Exp $   */
+/*     $NetBSD: compiler.h,v 1.2 2021/12/19 00:48:23 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,4 +32,18 @@
 #ifndef        _LINUX_COMPILER_H_
 #define        _LINUX_COMPILER_H_
 
+#include <sys/atomic.h>
+
+#define        READ_ONCE(X)    ({                                                    \
+       typeof(X) __read_once_tmp = (X);                                      \
+       membar_datadep_consumer();                                            \
+       __read_once_tmp;                                                      \
+})
+
+#define        WRITE_ONCE(X, V)        ({                                            \
+       typeof(X) __write_once_tmp = (V);                                     \
+       (X) = __write_once_tmp;                                               \
+       __write_once_tmp;                                                     \
+})
+
 #endif /* _LINUX_COMPILER_H_ */
diff -r e87810e9e3fd -r c2512197522c sys/external/bsd/common/include/linux/kernel.h
--- a/sys/external/bsd/common/include/linux/kernel.h    Sun Dec 19 00:48:16 2021 +0000
+++ b/sys/external/bsd/common/include/linux/kernel.h    Sun Dec 19 00:48:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernel.h,v 1.30 2021/12/19 00:48:16 riastradh Exp $    */
+/*     $NetBSD: kernel.h,v 1.31 2021/12/19 00:48:23 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -147,12 +147,6 @@
        }                                                               \
 } while (0)
 
-#define        ACCESS_ONCE(X) ({                                                     \
-       typeof(X) __access_once_tmp = (X);                                    \
-       __insn_barrier();                                                     \
-       __access_once_tmp;                                                    \
-})
-
 static __inline int64_t
 abs64(int64_t x)
 {



Home | Main Index | Thread Index | Old Index