Hexagon: fix atomic_set
authorRichard Kuo <rkuo@codeaurora.org>
Mon, 25 Nov 2013 19:49:26 +0000 (13:49 -0600)
committerRichard Kuo <rkuo@codeaurora.org>
Fri, 4 Apr 2014 23:20:02 +0000 (18:20 -0500)
Normal writes in our our architecture don't invalidate lock
reservations.

Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
arch/hexagon/include/asm/atomic.h

index 7aae4cb2a29a217a82b3ac482bfe7a1ea079327a..17dc63780c0695ec36d958bd753820d5ae36797a 100644 (file)
 #include <asm/cmpxchg.h>
 
 #define ATOMIC_INIT(i)         { (i) }
-#define atomic_set(v, i)       ((v)->counter = (i))
+
+/*  Normal writes in our arch don't clear lock reservations  */
+
+static inline void atomic_set(atomic_t *v, int new)
+{
+       asm volatile(
+               "1:     r6 = memw_locked(%0);\n"
+               "       memw_locked(%0,p0) = %1;\n"
+               "       if (!P0) jump 1b;\n"
+               :
+               : "r" (&v->counter), "r" (new)
+               : "memory", "p0", "r6"
+       );
+}
 
 /**
  * atomic_read - reads a word, atomically