]> git.baikalelectronics.ru Git - kernel.git/commit
tools headers: Restore READ_ONCE() C++ compatibility
authorMark Rutland <mark.rutland@arm.com>
Wed, 4 Apr 2018 16:34:45 +0000 (17:34 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 12 Apr 2018 12:30:09 +0000 (09:30 -0300)
commit18ca6d176b5a18408aaff4081e6119f936b2eaba
tree83e082d0151837b0a8db73fa5429abcdcaf4905d
parent02cad11d648bb1d6b5b02c799e4eae4a6929253c
tools headers: Restore READ_ONCE() C++ compatibility

Our userspace <linux/compiler.h> defines READ_ONCE() in a way that clang
doesn't like, as we have an anonymous union in which neither field is
initialized.

WRITE_ONCE() is fine since it initializes the __val field. For
READ_ONCE() we can keep clang and GCC happy with a dummy initialization
of the __c field, so let's do that.

At the same time, let's split READ_ONCE() and WRITE_ONCE() over several
lines for legibility, as we do in the in-kernel <linux/compiler.h>.

Reported-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reported-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
Tested-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Fixes: 569decfe85443c9a ("locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()")
Link: http://lkml.kernel.org/r/20180404163445.16492-1-mark.rutland@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/include/linux/compiler.h