X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=include%2Flinux%2Fcompiler.h;h=c8bd2daf95ec51e0f42ad05e6b8c13be1300ce16;hb=e9f76354ce83a20c7768ad37caa033f6506b4f96;hp=dcae0c8d97e6e2d04a8db04494e899eb403e1c18;hpb=03414e57ad9875d0c8bfa5a4a65813cb2157372e;p=linux-2.6-omap-h63xx.git diff --git a/include/linux/compiler.h b/include/linux/compiler.h index dcae0c8d97e..c8bd2daf95e 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -182,4 +182,16 @@ extern void __chk_io_ptr(const volatile void __iomem *); # define __section(S) __attribute__ ((__section__(#S))) #endif +/* + * Prevent the compiler from merging or refetching accesses. The compiler + * is also forbidden from reordering successive instances of ACCESS_ONCE(), + * but only when the compiler is aware of some particular ordering. One way + * to make the compiler aware of ordering is to put the two invocations of + * ACCESS_ONCE() in different C statements. + * + * This macro does absolutely -nothing- to prevent the CPU from reordering, + * merging, or refetching absolutely anything at any time. + */ +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) + #endif /* __LINUX_COMPILER_H */