Module Name: src
Committed By: riastradh
Date: Sun Dec 19 00:48:23 UTC 2021
Modified Files:
src/sys/external/bsd/common/include/linux: compiler.h kernel.h
Log Message:
Replace ACCESS_ONCE by READ_ONCE, WRITE_ONCE.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/common/include/linux/compiler.h
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/common/include/linux/kernel.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/common/include/linux/compiler.h
diff -u src/sys/external/bsd/common/include/linux/compiler.h:1.1 src/sys/external/bsd/common/include/linux/compiler.h:1.2
--- src/sys/external/bsd/common/include/linux/compiler.h:1.1 Sun Dec 19 00:45:28 2021
+++ src/sys/external/bsd/common/include/linux/compiler.h Sun Dec 19 00:48:23 2021
@@ -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_ */
Index: src/sys/external/bsd/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.30 src/sys/external/bsd/common/include/linux/kernel.h:1.31
--- src/sys/external/bsd/common/include/linux/kernel.h:1.30 Sun Dec 19 00:48:16 2021
+++ src/sys/external/bsd/common/include/linux/kernel.h Sun Dec 19 00:48:23 2021
@@ -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)
{