From 3628c887df1827fa60d965d1333378caa13078da Mon Sep 17 00:00:00 2001 From: Robert Jennings Date: Wed, 17 Jan 2007 10:50:20 -0600 Subject: [PATCH] --- yaml --- r: 45537 b: refs/heads/master c: 434f98c48fc1d2a1f562a28a1562a7b53e940957 h: refs/heads/master i: 45535: dcdbb71cf1814c44a94f4319450c03d1e394e627 v: v3 --- [refs] | 2 +- trunk/include/asm-powerpc/atomic.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 1b6b41e48aa8..cf50dbe738b4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 06cd9396778d5b70ba27fa8158db78d6bc0f007b +refs/heads/master: 434f98c48fc1d2a1f562a28a1562a7b53e940957 diff --git a/trunk/include/asm-powerpc/atomic.h b/trunk/include/asm-powerpc/atomic.h index 53283e2540b3..f038e33e6d48 100644 --- a/trunk/include/asm-powerpc/atomic.h +++ b/trunk/include/asm-powerpc/atomic.h @@ -207,7 +207,8 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) /* * Atomically test *v and decrement if it is greater than 0. - * The function returns the old value of *v minus 1. + * The function returns the old value of *v minus 1, even if + * the atomic variable, v, was not decremented. */ static __inline__ int atomic_dec_if_positive(atomic_t *v) { @@ -216,14 +217,15 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) __asm__ __volatile__( LWSYNC_ON_SMP "1: lwarx %0,0,%1 # atomic_dec_if_positive\n\ - addic. %0,%0,-1\n\ + cmpwi %0,1\n\ + addi %0,%0,-1\n\ blt- 2f\n" PPC405_ERR77(0,%1) " stwcx. %0,0,%1\n\ bne- 1b" ISYNC_ON_SMP "\n\ -2:" : "=&r" (t) +2:" : "=&b" (t) : "r" (&v->counter) : "cc", "memory");