On 02/15/2017 05:06 PM, Andrey Ryabinin wrote:
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h > index 10bca12..5d9dd63 100644 > --- a/include/linux/compiler.h > +++ b/include/linux/compiler.h > @@ -301,10 +301,10 @@ static __always_inline void __write_once_size(volatile > void *p, void *res, int s > */ > > #define __READ_ONCE(x, check) > \ > - __builtin_choose_expr(sizeof(x) == 1, *(volatile typeof(&(x)))&(x), \ > - __builtin_choose_expr(sizeof(x) == 2, *(volatile typeof(&(x)))&(x), \ > - __builtin_choose_expr(sizeof(x) == 4, *(volatile typeof(&(x)))&(x), \ > - __builtin_choose_expr(sizeof(x) == sizeof(long), *(volatile > typeof(&(x)))&(x), \ > + __builtin_choose_expr(sizeof(x) == 1, (typeof(x))(__u64)*(volatile __u8 > *)&(x), \ > + __builtin_choose_expr(sizeof(x) == 2, (typeof(x))(__u64)*(volatile > __u16 *)&(x), \ > + __builtin_choose_expr(sizeof(x) == 4, (typeof(x))(__u64)*(volatile > __u32 *)&(x), \ > + __builtin_choose_expr(sizeof(x) == 8, (typeof(x))(__u64)*(volatile > __u64 *)&(x), \ > ({union { typeof(x) __val; char __c[1]; } __u; \ > if (check) \ > __read_once_size(&(x), __u.__c, sizeof(x)); \ Scratch this, it doesn't work: ../arch/x86/mm/gup.c:20:2: error: conversion to non-scalar type requested return READ_ONCE(*ptep); ^