summaryrefslogtreecommitdiff
path: root/sys/external/bsd/common/include/linux
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-12-19 00:48:23 +0000
committerriastradh <riastradh@NetBSD.org>2021-12-19 00:48:23 +0000
commite5a638b191a9c5f0a135ce40cd9694b9bb2e0949 (patch)
treedc88d43842df796212235421a68797db2c89c09d /sys/external/bsd/common/include/linux
parente277e9db5d365d8d00388155dd847b050f9dad80 (diff)
Replace ACCESS_ONCE by READ_ONCE, WRITE_ONCE.
Diffstat (limited to 'sys/external/bsd/common/include/linux')
-rw-r--r--sys/external/bsd/common/include/linux/compiler.h16
-rw-r--r--sys/external/bsd/common/include/linux/kernel.h8
2 files changed, 16 insertions, 8 deletions
diff --git a/sys/external/bsd/common/include/linux/compiler.h b/sys/external/bsd/common/include/linux/compiler.h
index 0ccebdeee6b..100a59d7d7c 100644
--- a/sys/external/bsd/common/include/linux/compiler.h
+++ b/sys/external/bsd/common/include/linux/compiler.h
@@ -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 --git a/sys/external/bsd/common/include/linux/kernel.h b/sys/external/bsd/common/include/linux/kernel.h
index 9a29d1c2b8d..308761707ad 100644
--- a/sys/external/bsd/common/include/linux/kernel.h
+++ b/sys/external/bsd/common/include/linux/kernel.h
@@ -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)
{