diff options
Diffstat (limited to 'arch/x86/include/asm/rwsem.h')
-rw-r--r-- | arch/x86/include/asm/rwsem.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h index 453744c1d347..c5087706c02e 100644 --- a/arch/x86/include/asm/rwsem.h +++ b/arch/x86/include/asm/rwsem.h | |||
@@ -77,7 +77,7 @@ static inline void __down_read(struct rw_semaphore *sem) | |||
77 | /* | 77 | /* |
78 | * trylock for reading -- returns 1 if successful, 0 if contention | 78 | * trylock for reading -- returns 1 if successful, 0 if contention |
79 | */ | 79 | */ |
80 | static inline int __down_read_trylock(struct rw_semaphore *sem) | 80 | static inline bool __down_read_trylock(struct rw_semaphore *sem) |
81 | { | 81 | { |
82 | long result, tmp; | 82 | long result, tmp; |
83 | asm volatile("# beginning __down_read_trylock\n\t" | 83 | asm volatile("# beginning __down_read_trylock\n\t" |
@@ -93,7 +93,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) | |||
93 | : "+m" (sem->count), "=&a" (result), "=&r" (tmp) | 93 | : "+m" (sem->count), "=&a" (result), "=&r" (tmp) |
94 | : "i" (RWSEM_ACTIVE_READ_BIAS) | 94 | : "i" (RWSEM_ACTIVE_READ_BIAS) |
95 | : "memory", "cc"); | 95 | : "memory", "cc"); |
96 | return result >= 0 ? 1 : 0; | 96 | return result >= 0; |
97 | } | 97 | } |
98 | 98 | ||
99 | /* | 99 | /* |
@@ -134,9 +134,10 @@ static inline int __down_write_killable(struct rw_semaphore *sem) | |||
134 | /* | 134 | /* |
135 | * trylock for writing -- returns 1 if successful, 0 if contention | 135 | * trylock for writing -- returns 1 if successful, 0 if contention |
136 | */ | 136 | */ |
137 | static inline int __down_write_trylock(struct rw_semaphore *sem) | 137 | static inline bool __down_write_trylock(struct rw_semaphore *sem) |
138 | { | 138 | { |
139 | long result, tmp; | 139 | bool result; |
140 | long tmp0, tmp1; | ||
140 | asm volatile("# beginning __down_write_trylock\n\t" | 141 | asm volatile("# beginning __down_write_trylock\n\t" |
141 | " mov %0,%1\n\t" | 142 | " mov %0,%1\n\t" |
142 | "1:\n\t" | 143 | "1:\n\t" |
@@ -144,14 +145,14 @@ static inline int __down_write_trylock(struct rw_semaphore *sem) | |||
144 | /* was the active mask 0 before? */ | 145 | /* was the active mask 0 before? */ |
145 | " jnz 2f\n\t" | 146 | " jnz 2f\n\t" |
146 | " mov %1,%2\n\t" | 147 | " mov %1,%2\n\t" |
147 | " add %3,%2\n\t" | 148 | " add %4,%2\n\t" |
148 | LOCK_PREFIX " cmpxchg %2,%0\n\t" | 149 | LOCK_PREFIX " cmpxchg %2,%0\n\t" |
149 | " jnz 1b\n\t" | 150 | " jnz 1b\n\t" |
150 | "2:\n\t" | 151 | "2:\n\t" |
151 | " sete %b1\n\t" | 152 | " sete %3\n\t" |
152 | " movzbl %b1, %k1\n\t" | ||
153 | "# ending __down_write_trylock\n\t" | 153 | "# ending __down_write_trylock\n\t" |
154 | : "+m" (sem->count), "=&a" (result), "=&r" (tmp) | 154 | : "+m" (sem->count), "=&a" (tmp0), "=&r" (tmp1), |
155 | "=qm" (result) | ||
155 | : "er" (RWSEM_ACTIVE_WRITE_BIAS) | 156 | : "er" (RWSEM_ACTIVE_WRITE_BIAS) |
156 | : "memory", "cc"); | 157 | : "memory", "cc"); |
157 | return result; | 158 | return result; |