Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Aug 2017 12:45:55 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r322498 - stable/11/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201708141245.v7ECjtbD056207@repo.freebsd.org>

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



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