Merge tag 'for_linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel...
[sfrench/cifs-2.6.git] / tools / include / asm-generic / barrier.h
1 /*
2  * Copied from the kernel sources to tools/perf/:
3  *
4  * Generic barrier definitions.
5  *
6  * It should be possible to use these on really simple architectures,
7  * but it serves more as a starting point for new ports.
8  *
9  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
10  * Written by David Howells (dhowells@redhat.com)
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public Licence
14  * as published by the Free Software Foundation; either version
15  * 2 of the Licence, or (at your option) any later version.
16  */
17 #ifndef __TOOLS_LINUX_ASM_GENERIC_BARRIER_H
18 #define __TOOLS_LINUX_ASM_GENERIC_BARRIER_H
19
20 #ifndef __ASSEMBLY__
21
22 #include <linux/compiler.h>
23
24 /*
25  * Force strict CPU ordering. And yes, this is required on UP too when we're
26  * talking to devices.
27  *
28  * Fall back to compiler barriers if nothing better is provided.
29  */
30
31 #ifndef mb
32 #define mb()    barrier()
33 #endif
34
35 #ifndef rmb
36 #define rmb()   mb()
37 #endif
38
39 #ifndef wmb
40 #define wmb()   mb()
41 #endif
42
43 #endif /* !__ASSEMBLY__ */
44 #endif /* __TOOLS_LINUX_ASM_GENERIC_BARRIER_H */