UBUNTU: Ubuntu-2.6.38-12.51
[linux-flexiantxendom0-natty.git] / lib / atomic64_test.c
index 0effcac..44524cc 100644 (file)
@@ -9,6 +9,7 @@
  * (at your option) any later version.
  */
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <asm/atomic.h>
 
 #define INIT(c) do { atomic64_set(&v, c); r = c; } while (0)
@@ -104,15 +105,16 @@ static __init int test_atomic64(void)
        BUG_ON(v.counter != r);
 
        INIT(v0);
-       BUG_ON(!atomic64_add_unless(&v, one, v0));
+       BUG_ON(atomic64_add_unless(&v, one, v0));
        BUG_ON(v.counter != r);
 
        INIT(v0);
-       BUG_ON(atomic64_add_unless(&v, one, v1));
+       BUG_ON(!atomic64_add_unless(&v, one, v1));
        r += one;
        BUG_ON(v.counter != r);
 
-#if defined(CONFIG_X86_32) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(_ASM_GENERIC_ATOMIC64_H)
+#if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
+    defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H) || defined(CONFIG_ARM)
        INIT(onestwos);
        BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1));
        r -= one;
@@ -130,28 +132,30 @@ static __init int test_atomic64(void)
 #endif
 
        INIT(onestwos);
-       BUG_ON(atomic64_inc_not_zero(&v));
+       BUG_ON(!atomic64_inc_not_zero(&v));
        r += one;
        BUG_ON(v.counter != r);
 
        INIT(0);
-       BUG_ON(!atomic64_inc_not_zero(&v));
+       BUG_ON(atomic64_inc_not_zero(&v));
        BUG_ON(v.counter != r);
 
        INIT(-one);
-       BUG_ON(atomic64_inc_not_zero(&v));
+       BUG_ON(!atomic64_inc_not_zero(&v));
        r += one;
        BUG_ON(v.counter != r);
 
 #ifdef CONFIG_X86
-       printk(KERN_INFO "atomic64 test passed for %s+ platform %s CX8 and %s SSE\n",
-#ifdef CONFIG_X86_CMPXCHG64
-                       "586",
+       printk(KERN_INFO "atomic64 test passed for %s platform %s CX8 and %s SSE\n",
+#ifdef CONFIG_X86_64
+              "x86-64",
+#elif defined(CONFIG_X86_CMPXCHG64)
+              "i586+",
 #else
-                       "386",
+              "i386+",
 #endif
-                       boot_cpu_has(X86_FEATURE_CX8) ? "with" : "without",
-                       boot_cpu_has(X86_FEATURE_XMM) ? "with" : "without");
+              boot_cpu_has(X86_FEATURE_CX8) ? "with" : "without",
+              boot_cpu_has(X86_FEATURE_XMM) ? "with" : "without");
 #else
        printk(KERN_INFO "atomic64 test passed\n");
 #endif