diff options
| author | David S. Miller <davem@davemloft.net> | 2018-04-24 23:59:11 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2018-04-24 23:59:11 -0400 |
| commit | c749fa181bd5848be78691d23168ec61ce691b95 (patch) | |
| tree | d037dc016bd880d9d5b393a30f3907ef5e98124d /tools/include/linux/compiler.h | |
| parent | 16f4faa4f06ff3b4e214922d55ac33ab6e2bdbdc (diff) | |
| parent | 3be4aaf4e2d3eb95cce7835e8df797ae65ae5ac1 (diff) | |
| download | blackbird-op-linux-c749fa181bd5848be78691d23168ec61ce691b95.tar.gz blackbird-op-linux-c749fa181bd5848be78691d23168ec61ce691b95.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'tools/include/linux/compiler.h')
| -rw-r--r-- | tools/include/linux/compiler.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index 04e32f965ad7..1827c2f973f9 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h @@ -151,11 +151,21 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s * required ordering. */ -#define READ_ONCE(x) \ - ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) - -#define WRITE_ONCE(x, val) \ - ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) +#define READ_ONCE(x) \ +({ \ + union { typeof(x) __val; char __c[1]; } __u = \ + { .__c = { 0 } }; \ + __read_once_size(&(x), __u.__c, sizeof(x)); \ + __u.__val; \ +}) + +#define WRITE_ONCE(x, val) \ +({ \ + union { typeof(x) __val; char __c[1]; } __u = \ + { .__val = (val) }; \ + __write_once_size(&(x), __u.__c, sizeof(x)); \ + __u.__val; \ +}) #ifndef __fallthrough |

