]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-i386/mutex.h
[PATCH] kill unushed __put_task_struct_cb
[linux-2.6-omap-h63xx.git] / include / asm-i386 / mutex.h
index 4e5e3de1b9a69714424118c52e21707136a78bed..05a5385312294582a082592838f600c4b9ab7a32 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef _ASM_MUTEX_H
 #define _ASM_MUTEX_H
 
+#include "asm/alternative.h"
+
 /**
  *  __mutex_fastpath_lock - try to take the lock by moving the count
  *                          from 1 to a 0 value
@@ -27,8 +29,14 @@ do {                                                                 \
        typecheck_fn(fastcall void (*)(atomic_t *), fail_fn);           \
                                                                        \
        __asm__ __volatile__(                                           \
-               LOCK    "   decl (%%eax)        \n"                     \
-                       "   js "#fail_fn"       \n"                     \
+               LOCK_PREFIX "   decl (%%eax)    \n"                     \
+                       "   js 2f               \n"                     \
+                       "1:                     \n"                     \
+                                                                       \
+               LOCK_SECTION_START("")                                  \
+                       "2: call "#fail_fn"     \n"                     \
+                       "   jmp 1b              \n"                     \
+               LOCK_SECTION_END                                        \
                                                                        \
                :"=a" (dummy)                                           \
                : "a" (count)                                           \
@@ -77,8 +85,14 @@ do {                                                                 \
        typecheck_fn(fastcall void (*)(atomic_t *), fail_fn);           \
                                                                        \
        __asm__ __volatile__(                                           \
-               LOCK    "   incl (%%eax)        \n"                     \
-                       "   jle "#fail_fn"      \n"                     \
+               LOCK_PREFIX "   incl (%%eax)    \n"                     \
+                       "   jle 2f              \n"                     \
+                       "1:                     \n"                     \
+                                                                       \
+               LOCK_SECTION_START("")                                  \
+                       "2: call "#fail_fn"     \n"                     \
+                       "   jmp 1b              \n"                     \
+               LOCK_SECTION_END                                        \
                                                                        \
                :"=a" (dummy)                                           \
                : "a" (count)                                           \
@@ -113,7 +127,7 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
         * the mutex state would be.
         */
 #ifdef __HAVE_ARCH_CMPXCHG
-       if (likely(atomic_cmpxchg(count, 1, 0)) == 1)
+       if (likely(atomic_cmpxchg(count, 1, 0) == 1))
                return 1;
        return 0;
 #else