Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Apr 2023 11:52:23 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 74e908b3c63b - main - LinuxKPI: fix READ_ONCE() -Wcast-equal warnings
Message-ID:  <202304201152.33KBqNaw016563@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;				\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304201152.33KBqNaw016563>