powerpc: Fix circular dependency between percpu.h and mmu.h
[linux-2.6-microblaze.git] / include / asm-generic / barrier.h
index 85b28eb..b589bb2 100644 (file)
@@ -128,10 +128,10 @@ do {                                                                      \
 #ifndef __smp_load_acquire
 #define __smp_load_acquire(p)                                          \
 ({                                                                     \
-       typeof(*p) ___p1 = READ_ONCE(*p);                               \
+       __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
        compiletime_assert_atomic_type(*p);                             \
        __smp_mb();                                                     \
-       ___p1;                                                          \
+       (typeof(*p))___p1;                                              \
 })
 #endif
 
@@ -183,10 +183,10 @@ do {                                                                      \
 #ifndef smp_load_acquire
 #define smp_load_acquire(p)                                            \
 ({                                                                     \
-       typeof(*p) ___p1 = READ_ONCE(*p);                               \
+       __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
        compiletime_assert_atomic_type(*p);                             \
        barrier();                                                      \
-       ___p1;                                                          \
+       (typeof(*p))___p1;                                              \
 })
 #endif
 
@@ -229,14 +229,14 @@ do {                                                                      \
 #ifndef smp_cond_load_relaxed
 #define smp_cond_load_relaxed(ptr, cond_expr) ({               \
        typeof(ptr) __PTR = (ptr);                              \
-       typeof(*ptr) VAL;                                       \
+       __unqual_scalar_typeof(*ptr) VAL;                       \
        for (;;) {                                              \
                VAL = READ_ONCE(*__PTR);                        \
                if (cond_expr)                                  \
                        break;                                  \
                cpu_relax();                                    \
        }                                                       \
-       VAL;                                                    \
+       (typeof(*ptr))VAL;                                      \
 })
 #endif
 
@@ -250,12 +250,22 @@ do {                                                                      \
  */
 #ifndef smp_cond_load_acquire
 #define smp_cond_load_acquire(ptr, cond_expr) ({               \
-       typeof(*ptr) _val;                                      \
+       __unqual_scalar_typeof(*ptr) _val;                      \
        _val = smp_cond_load_relaxed(ptr, cond_expr);           \
        smp_acquire__after_ctrl_dep();                          \
-       _val;                                                   \
+       (typeof(*ptr))_val;                                     \
 })
 #endif
 
+/*
+ * pmem_wmb() ensures that all stores for which the modification
+ * are written to persistent storage by preceding instructions have
+ * updated persistent storage before any data  access or data transfer
+ * caused by subsequent instructions is initiated.
+ */
+#ifndef pmem_wmb
+#define pmem_wmb()     wmb()
+#endif
+
 #endif /* !__ASSEMBLY__ */
 #endif /* __ASM_GENERIC_BARRIER_H */