x86: use immediates instead of RW_LOCK_BIAS_STR
authorThomas Gleixner <tglx@linutronix.de>
Wed, 30 Jan 2008 12:30:34 +0000 (13:30 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:30:34 +0000 (13:30 +0100)
Use immediate instead of the RW_LOCK_BIAS_STR.
Makes the code more readable and gets rid of the string constant.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/asm-x86/rwlock.h
include/asm-x86/spinlock_32.h
include/asm-x86/spinlock_64.h

index f2b64a429e6b8eae6580852ff12b1ca5cb25a329..6a8c0d6451080658c6b2bee54fad409b11d47a9a 100644 (file)
@@ -2,7 +2,6 @@
 #define _ASM_X86_RWLOCK_H
 
 #define RW_LOCK_BIAS            0x01000000
-#define RW_LOCK_BIAS_STR       "0x01000000"
 
 /* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */
 
index fca124a1103d930c6ae27234ea9c34a50fc42e04..e7a14ab906e97c7b96ad946f35aeef6db9ef28d5 100644 (file)
@@ -156,11 +156,11 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
 
 static inline void __raw_write_lock(raw_rwlock_t *rw)
 {
-       asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t"
+       asm volatile(LOCK_PREFIX " subl %1,(%0)\n\t"
                     "jz 1f\n"
                     "call __write_lock_failed\n\t"
                     "1:\n"
-                    ::"a" (rw) : "memory");
+                    ::"a" (rw), "i" (RW_LOCK_BIAS) : "memory");
 }
 
 static inline int __raw_read_trylock(raw_rwlock_t *lock)
@@ -191,8 +191,8 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
 
 static inline void __raw_write_unlock(raw_rwlock_t *rw)
 {
-       asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0"
-                                : "+m" (rw->lock) : : "memory");
+       asm volatile(LOCK_PREFIX "addl %1, %0"
+                    : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory");
 }
 
 #define _raw_spin_relax(lock)  cpu_relax()
index e81f6c18d87775dae9b850e46a477b442f6d35b1..ab50e7f51058c674e1574a94d9f3dab5a48614a8 100644 (file)
@@ -127,7 +127,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
                     "jns 1f\n"
                     "call __read_lock_failed\n\t"
                     "1:\n"
-                    ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory");
+                    ::"D" (rw) : "memory");
 }
 
 static inline void __raw_write_lock(raw_rwlock_t *rw)
@@ -167,8 +167,8 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
 
 static inline void __raw_write_unlock(raw_rwlock_t *rw)
 {
-       asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0"
-                               : "+m" (rw->lock) : : "memory");
+       asm volatile(LOCK_PREFIX "addl %1, %0"
+                    : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory");
 }
 
 #define _raw_spin_relax(lock)  cpu_relax()