mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Confirmed-by: Paul Mackerras <[email protected]> Signed-off-by: Luca Barbieri <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: H. Peter Anvin <[email protected]>
This commit is contained in:
parent
6e6104fe08
commit
97577896f6
1 changed files with 2 additions and 2 deletions
|
|
@ -162,12 +162,12 @@ int atomic64_add_unless(atomic64_t *v, long long a, long long u)
|
|||
{
|
||||
unsigned long flags;
|
||||
spinlock_t *lock = lock_addr(v);
|
||||
int ret = 1;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(lock, flags);
|
||||
if (v->counter != u) {
|
||||
v->counter += a;
|
||||
ret = 0;
|
||||
ret = 1;
|
||||
}
|
||||
spin_unlock_irqrestore(lock, flags);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue