Commit 6514f93a2ce643ef5914eae7ce49b978e1d356aa
Committed by
Ingo Molnar
1 parent
a33fff3a03
Exists in
master
and in
7 other branches
x86: use immediates instead of RW_LOCK_BIAS_STR
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>
Showing 3 changed files with 7 additions and 8 deletions Side-by-side Diff
include/asm-x86/rwlock.h
include/asm-x86/spinlock_32.h
... | ... | @@ -156,11 +156,11 @@ |
156 | 156 | |
157 | 157 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
158 | 158 | { |
159 | - asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" | |
159 | + asm volatile(LOCK_PREFIX " subl %1,(%0)\n\t" | |
160 | 160 | "jz 1f\n" |
161 | 161 | "call __write_lock_failed\n\t" |
162 | 162 | "1:\n" |
163 | - ::"a" (rw) : "memory"); | |
163 | + ::"a" (rw), "i" (RW_LOCK_BIAS) : "memory"); | |
164 | 164 | } |
165 | 165 | |
166 | 166 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
... | ... | @@ -191,8 +191,8 @@ |
191 | 191 | |
192 | 192 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
193 | 193 | { |
194 | - asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0" | |
195 | - : "+m" (rw->lock) : : "memory"); | |
194 | + asm volatile(LOCK_PREFIX "addl %1, %0" | |
195 | + : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory"); | |
196 | 196 | } |
197 | 197 | |
198 | 198 | #define _raw_spin_relax(lock) cpu_relax() |
include/asm-x86/spinlock_64.h
... | ... | @@ -127,7 +127,7 @@ |
127 | 127 | "jns 1f\n" |
128 | 128 | "call __read_lock_failed\n\t" |
129 | 129 | "1:\n" |
130 | - ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory"); | |
130 | + ::"D" (rw) : "memory"); | |
131 | 131 | } |
132 | 132 | |
133 | 133 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
... | ... | @@ -167,8 +167,8 @@ |
167 | 167 | |
168 | 168 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
169 | 169 | { |
170 | - asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0" | |
171 | - : "+m" (rw->lock) : : "memory"); | |
170 | + asm volatile(LOCK_PREFIX "addl %1, %0" | |
171 | + : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory"); | |
172 | 172 | } |
173 | 173 | |
174 | 174 | #define _raw_spin_relax(lock) cpu_relax() |