summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/atomic.h
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2011-08-24 01:59:58 +0200
committerH. Peter Anvin <hpa@linux.intel.com>2011-08-29 22:44:12 +0200
commit8b8bc2f7311c3223213dbe346d9cc2e299fdb5eb (patch)
tree50a2f0faa3762084336be4f97c03a97b14b22262 /arch/x86/include/asm/atomic.h
parentx86: Add xadd helper macro (diff)
downloadlinux-8b8bc2f7311c3223213dbe346d9cc2e299fdb5eb.tar.xz
linux-8b8bc2f7311c3223213dbe346d9cc2e299fdb5eb.zip
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>
Diffstat (limited to 'arch/x86/include/asm/atomic.h')
-rw-r--r--arch/x86/include/asm/atomic.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 10572e309ab2..58cb6d4085f7 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -172,18 +172,14 @@ static inline int atomic_add_negative(int i, atomic_t *v)
*/
static inline int atomic_add_return(int i, atomic_t *v)
{
- int __i;
#ifdef CONFIG_M386
+ int __i;
unsigned long flags;
if (unlikely(boot_cpu_data.x86 <= 3))
goto no_xadd;
#endif
/* Modern 486+ processor */
- __i = i;
- asm volatile(LOCK_PREFIX "xaddl %0, %1"
- : "+r" (i), "+m" (v->counter)
- : : "memory");
- return i + __i;
+ return i + xadd(&v->counter, i);
#ifdef CONFIG_M386
no_xadd: /* Legacy 386 processor */