x86: Use xadd helper more widely
This covers the trivial cases from open-coded xadd to the xadd macros. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Link: http://lkml.kernel.org/r/4E5BCC40.3030501@goop.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
committed by
H. Peter Anvin
parent
433b352061
commit
8b8bc2f731
@@ -204,13 +204,7 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
|
||||
*/
|
||||
static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
|
||||
{
|
||||
long tmp = delta;
|
||||
|
||||
asm volatile(LOCK_PREFIX "xadd %0,%1"
|
||||
: "+r" (tmp), "+m" (sem->count)
|
||||
: : "memory");
|
||||
|
||||
return tmp + delta;
|
||||
return delta + xadd(&sem->count, delta);
|
||||
}
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
Reference in New Issue
Block a user