Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367937
b: refs/heads/master
c: e0025a7
h: refs/heads/master
i:
  367935: 2717a0e
v: v3
  • Loading branch information
Richard Kuo committed May 1, 2013
1 parent 10a3dee commit 99ddde1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22493cfd78e4db0ba9c9f46dac4757bee5a0294a
refs/heads/master: e0025a72c37ca404fbf31d569439c20bfb04295e
20 changes: 11 additions & 9 deletions trunk/arch/hexagon/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,35 +117,37 @@ static inline int atomic_sub_return(int i, atomic_t *v)
#define atomic_sub(i, v) atomic_sub_return(i, (v))

/**
* atomic_add_unless - add unless the number is a given value
* __atomic_add_unless - add unless the number is a given value
* @v: pointer to value
* @a: amount to add
* @u: unless value is equal to u
*
* Returns 1 if the add happened, 0 if it didn't.
* Returns old value.
*
*/

static inline int __atomic_add_unless(atomic_t *v, int a, int u)
{
int output, __oldval;
int __oldval;
register int tmp;

asm volatile(
"1: %0 = memw_locked(%2);"
" {"
" p3 = cmp.eq(%0, %4);"
" if (p3.new) jump:nt 2f;"
" %0 = add(%0, %3);"
" %1 = #0;"
" %1 = add(%0, %3);"
" }"
" memw_locked(%2, p3) = %0;"
" memw_locked(%2, p3) = %1;"
" {"
" if !p3 jump 1b;"
" %1 = #1;"
" }"
"2:"
: "=&r" (__oldval), "=&r" (output)
: "=&r" (__oldval), "=&r" (tmp)
: "r" (v), "r" (a), "r" (u)
: "memory", "p3"
);
return output;
return __oldval;
}

#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
Expand Down

0 comments on commit 99ddde1

Please sign in to comment.