git: 74e908b3c63b - main - LinuxKPI: fix READ_ONCE() -Wcast-equal warnings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 20 Apr 2023 11:52:23 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=74e908b3c63b28de1d590dc42502fbe959a6da2e
commit 74e908b3c63b28de1d590dc42502fbe959a6da2e
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-04-19 21:43:59 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-04-20 11:51:22 +0000
LinuxKPI: fix READ_ONCE() -Wcast-equal warnings
Rather than using ACCESS_ONCE() in READ_ONCE() add a missing cast
to const in order to satisfy -Wcast-equal by gcc.
Sadly we cannot do the same to WRITE_ONCE() which still is very
noisy.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D39706
---
sys/compat/linuxkpi/common/include/linux/compiler.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 87a37228736f..801618e15f9f 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -98,7 +98,7 @@
#define READ_ONCE(x) ({ \
__typeof(x) __var = ({ \
barrier(); \
- ACCESS_ONCE(x); \
+ (*(const volatile __typeof(x) *)&(x)); \
}); \
barrier(); \
__var; \