Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2017 20:24:34 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314878 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201703072024.v27KOYWN042208@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Mar  7 20:24:34 2017
New Revision: 314878
URL: https://svnweb.freebsd.org/changeset/base/314878

Log:
  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.
  
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/compiler.h

Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/compiler.h	Tue Mar  7 19:30:22 2017	(r314877)
+++ head/sys/compat/linuxkpi/common/include/linux/compiler.h	Tue Mar  7 20:24:34 2017	(r314878)
@@ -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;				\
 })



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