Re: [PATCH] atomic_cmpxchg return type error

From: Andi Kleen
Date: Thu Nov 30 2006 - 18:24:34 EST


On Thu, Nov 30, 2006 at 04:17:06PM -0500, Mathieu Desnoyers wrote:
> Hi,
>
> I just noticed that a atomic_cmpxchg, that would be given an atomic64_t
> parameter, would cast the return value as a (int). In the typical use of this
> primitive, the result would be that the 32 MSB would be lost when comparing
> against the original value. It also affects atomic_add_unless. Note that there
> is no atomic64_cmpxchg nor atomic64_add_unless, which might make things a
> little clearer.

Normally you're supposed to only use atomic64_* with atomic64_t

While it works for most by accident on x86 to just use atomic_*
with atomic64_t it's not portable to other architectures.

If you want to use those with atomic64_t suitable macros would need
to be added on all architectures.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/