Skip to content

Commit

Permalink
Hexagon: fix atomic_set
Browse files Browse the repository at this point in the history
Normal writes in our our architecture don't invalidate lock
reservations.

Signed-off-by: Richard Kuo <[email protected]>
  • Loading branch information
Richard Kuo committed Apr 4, 2014
1 parent 17ca896 commit b10fa7b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion arch/hexagon/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@
#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
Expand Down

0 comments on commit b10fa7b

Please sign in to comment.