Commit 97577896f6b9c056fa0a5e9f6a608110cb3dcd33

Authored by Luca Barbieri
Committed by H. Peter Anvin
1 parent 6e6104fe08

lib: Fix atomic64_add_unless return value convention

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The generic implementation did the opposite thing.

Reported-by: H. Peter Anvin <hpa@zytor.com>
Confirmed-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
LKML-Reference: <1267469749-11878-4-git-send-email-luca@luca-barbieri.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

... ... @@ -162,12 +162,12 @@
162 162 {
163 163 unsigned long flags;
164 164 spinlock_t *lock = lock_addr(v);
165   - int ret = 1;
  165 + int ret = 0;
166 166  
167 167 spin_lock_irqsave(lock, flags);
168 168 if (v->counter != u) {
169 169 v->counter += a;
170   - ret = 0;
  170 + ret = 1;
171 171 }
172 172 spin_unlock_irqrestore(lock, flags);
173 173 return ret;