Re: [mmotm] "x86/atomic: move __arch_atomic_add_unless out of line" build error
From: Andi Kleen
Date: Thu Mar 16 2017 - 12:41:26 EST
> Andi, why did you completely remove __arch_atomic_add_unless() from
> the header? Don't we need at least a declaration there?
Actually it's there in my git version:
I wonder where it disappeared.
-/**
- * __atomic_add_unless - add unless the number is already a given value
- * @v: pointer of type atomic_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as @v was not already @u.
- * Returns the old value of @v.
- */
-static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u)
-{
- int c, old;
- c = atomic_read(v);
- for (;;) {
- if (unlikely(c == (u)))
- break;
- old = atomic_cmpxchg((v), c, c + (a));
- if (likely(old == c))
- break;
- c = old;
- }
- return c;
-}
+int __atomic_add_unless(atomic_t *v, int a, int u);