summaryrefslogtreecommitdiffstats
path: root/include/asm-alpha/barrier.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2005-10-25 08:05:58 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-25 18:32:46 +0200
commit0db9ae4a79381a5a3d272ccb51851c48c4bcbb6d (patch)
tree2799d939a04135e036eece1159771badac48e6e8 /include/asm-alpha/barrier.h
parent[PATCH] Return the line length via sysfs for fbdev (diff)
downloadlinux-0db9ae4a79381a5a3d272ccb51851c48c4bcbb6d.tar.xz
linux-0db9ae4a79381a5a3d272ccb51851c48c4bcbb6d.zip
[PATCH] alpha: atomic dependency fix
My alpha build is exploding because asm/atomic.h now needs smb_mb(), which is over in the (not included) system.h. I fear what will happen if I include system.h into atomic.h, so let's put the barriers into their own header file. Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-alpha/barrier.h')
-rw-r--r--include/asm-alpha/barrier.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/asm-alpha/barrier.h b/include/asm-alpha/barrier.h
new file mode 100644
index 000000000000..229c83fe77cb
--- /dev/null
+++ b/include/asm-alpha/barrier.h
@@ -0,0 +1,34 @@
+#ifndef __BARRIER_H
+#define __BARRIER_H
+
+#define mb() \
+__asm__ __volatile__("mb": : :"memory")
+
+#define rmb() \
+__asm__ __volatile__("mb": : :"memory")
+
+#define wmb() \
+__asm__ __volatile__("wmb": : :"memory")
+
+#define read_barrier_depends() \
+__asm__ __volatile__("mb": : :"memory")
+
+#ifdef CONFIG_SMP
+#define smp_mb() mb()
+#define smp_rmb() rmb()
+#define smp_wmb() wmb()
+#define smp_read_barrier_depends() read_barrier_depends()
+#else
+#define smp_mb() barrier()
+#define smp_rmb() barrier()
+#define smp_wmb() barrier()
+#define smp_read_barrier_depends() barrier()
+#endif
+
+#define set_mb(var, value) \
+do { var = value; mb(); } while (0)
+
+#define set_wmb(var, value) \
+do { var = value; wmb(); } while (0)
+
+#endif /* __BARRIER_H */