arch: Move smp_mb__{before,after}_atomic_{inc,dec}.h into asm/atomic.h
authorPeter Zijlstra <peterz@infradead.org>
Fri, 8 Nov 2013 11:01:59 +0000 (12:01 +0100)
committerIngo Molnar <mingo@kernel.org>
Sun, 12 Jan 2014 09:37:14 +0000 (10:37 +0100)
Move the barriers functions that depend on the atomic implementation
into the atomic implementation.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Vineet Gupta <vgupta@synopsys.com> [for arch/arc bits]
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20131213150640.786183683@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/arc/include/asm/atomic.h
arch/arc/include/asm/barrier.h
arch/hexagon/include/asm/atomic.h
arch/hexagon/include/asm/barrier.h

index 83f03ca6caf6c7f09f171a66581d062a7333ccdd..03e494f695d1d1ecabe7be6df8057ae21504f413 100644 (file)
@@ -190,6 +190,11 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
 
 #endif /* !CONFIG_ARC_HAS_LLSC */
 
+#define smp_mb__before_atomic_dec()    barrier()
+#define smp_mb__after_atomic_dec()     barrier()
+#define smp_mb__before_atomic_inc()    barrier()
+#define smp_mb__after_atomic_inc()     barrier()
+
 /**
  * __atomic_add_unless - add unless the number is a given value
  * @v: pointer of type atomic_t
index f6cb7c4ffb35029316d2c549c2a6db5d95f86e0e..c32245c3d1e9b59263dfee9fdfcbb78040e866f6 100644 (file)
 #define smp_wmb()       barrier()
 #endif
 
-#define smp_mb__before_atomic_dec()    barrier()
-#define smp_mb__after_atomic_dec()     barrier()
-#define smp_mb__before_atomic_inc()    barrier()
-#define smp_mb__after_atomic_inc()     barrier()
-
 #define smp_read_barrier_depends()      do { } while (0)
 
 #endif
index 8a64ff2337f651dda91e1d55396e5578262fb9e9..7aae4cb2a29a217a82b3ac482bfe7a1ea079327a 100644 (file)
@@ -160,8 +160,12 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 #define atomic_sub_and_test(i, v) (atomic_sub_return(i, (v)) == 0)
 #define atomic_add_negative(i, v) (atomic_add_return(i, (v)) < 0)
 
-
 #define atomic_inc_return(v) (atomic_add_return(1, v))
 #define atomic_dec_return(v) (atomic_sub_return(1, v))
 
+#define smp_mb__before_atomic_dec()    barrier()
+#define smp_mb__after_atomic_dec()     barrier()
+#define smp_mb__before_atomic_inc()    barrier()
+#define smp_mb__after_atomic_inc()     barrier()
+
 #endif
index 1041a8e70ce85cea7e8b2d9372dbb8fef19c8496..4e863daea25b70e709a80623cd8cd1996a624005 100644 (file)
 #define smp_read_barrier_depends()     barrier()
 #define smp_wmb()                      barrier()
 #define smp_mb()                       barrier()
-#define smp_mb__before_atomic_dec()    barrier()
-#define smp_mb__after_atomic_dec()     barrier()
-#define smp_mb__before_atomic_inc()    barrier()
-#define smp_mb__after_atomic_inc()     barrier()
 
 /*  Set a value and use a memory barrier.  Used by the scheduler somewhere.  */
 #define set_mb(var, value) \