Commit:     e656e245d5adf19f3c431e7f7792659c204e32f2
Parent:     bb2382c3e4395ab595278cc7b92ac3f2eaf23f66
Author:     Mathieu Desnoyers <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 00:34:20 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 8 11:15:19 2007 -0700

    atomic.h: i386 type safety fix
    Remove an explicit cast to an integer type for the result returned by 
     It is not per se a problem on the i386 architecture, because sizeof(int) ==
    sizeof(long), but whenever this code is cut'n'pasted to a accept passing an
    atomic64_t value as parameter to cmpxchg, xchg and add_unless, having 64 
    inputs casted to 32 bits.
    Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]>
    Cc: Andi Kleen <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 include/asm-i386/atomic.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index 4dd2723..0893511 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -207,8 +207,8 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
        return atomic_add_return(-i,v);
-#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new))
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
+#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
+#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
  * atomic_add_unless - add unless the number is already a given value
@@ -221,7 +221,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
 #define atomic_add_unless(v, a, u)                             \
 ({                                                             \
-       int c, old;                                             \
+       __typeof__((v)->counter) c, old;                        \
        c = atomic_read(v);                                     \
        for (;;) {                                              \
                if (unlikely(c == (u)))                         \
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to