linux-2.6.33/atomic_add_return()
/** * atomic_add_return - add integer and return * @v: pointer of type atomic_t * @i: integer value to add * * Atomically adds @i to @v and returns @i + @v */ static inline int atomic_add_return(int i, atomic_t *v) { int __i; #ifdef CONFIG_M386
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;
#ifdef CONFIG_M386 no_xadd: /* Legacy 386 processor */ local_irq_save(flags);
__i = atomic_read(v);
atomic_set(v, i + __i);
local_irq_restore(flags);
return i + __i; #endif }