svn commit: r322498 - stable/11/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Mon Aug 14 12:45:56 UTC 2017


Author: hselasky
Date: Mon Aug 14 12:45:55 2017
New Revision: 322498
URL: https://svnweb.freebsd.org/changeset/base/322498

Log:
  MFC r314878:
  Add support for constant pointer constructs to READ_ONCE() in the
  LinuxKPI. When the type of the argument is constant the temporary
  variable cannot be assigned after the barrier. Instead assign the
  temporary variable by initialization.
  
  Sponsored by:		Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h	Mon Aug 14 12:36:58 2017	(r322497)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h	Mon Aug 14 12:45:55 2017	(r322498)
@@ -86,9 +86,10 @@
 } while (0)
 
 #define	READ_ONCE(x) ({			\
-	__typeof(x) __var;		\
-	barrier();			\
-	__var = ACCESS_ONCE(x);		\
+	__typeof(x) __var = ({		\
+		barrier();		\
+		ACCESS_ONCE(x);		\
+	});				\
 	barrier();			\
 	__var;				\
 })


More information about the svn-src-all mailing list