diff options
author | Cliff Wickman <cpw@sgi.com> | 2008-06-04 16:33:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 06:23:23 -0400 |
commit | 73e991f45fe7644711c0c9dd357a1a2c6e222707 (patch) | |
tree | 16e10a4774791b8ecf8046546f36af3fbb0bac51 /include/asm-x86/atomic_64.h | |
parent | 1812924bb1823950c1dc95c478b71b037057356e (diff) |
x86 atomic operations: atomic_or_long() atomic_inc_short()
Provide atomic operations for increment of a 16-bit integer and
logical OR into a 64-bit integer.
Signed-off-by: Cliff Wickman <cpw@sgi.com>
Reviewed-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/atomic_64.h')
-rw-r--r-- | include/asm-x86/atomic_64.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/asm-x86/atomic_64.h b/include/asm-x86/atomic_64.h index 3e0cd7d38335..55c0dd9382b8 100644 --- a/include/asm-x86/atomic_64.h +++ b/include/asm-x86/atomic_64.h | |||
@@ -431,6 +431,32 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u) | |||
431 | return c != (u); | 431 | return c != (u); |
432 | } | 432 | } |
433 | 433 | ||
434 | /** | ||
435 | * atomic_inc_short - increment of a short integer | ||
436 | * @v: pointer to type int | ||
437 | * | ||
438 | * Atomically adds 1 to @v | ||
439 | * Returns the new value of @u | ||
440 | */ | ||
441 | static inline short int atomic_inc_short(short int *v) | ||
442 | { | ||
443 | asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v)); | ||
444 | return *v; | ||
445 | } | ||
446 | |||
447 | /** | ||
448 | * atomic_or_long - OR of two long integers | ||
449 | * @v1: pointer to type unsigned long | ||
450 | * @v2: pointer to type unsigned long | ||
451 | * | ||
452 | * Atomically ORs @v1 and @v2 | ||
453 | * Returns the result of the OR | ||
454 | */ | ||
455 | static inline void atomic_or_long(unsigned long *v1, unsigned long v2) | ||
456 | { | ||
457 | asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2)); | ||
458 | } | ||
459 | |||
434 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | 460 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) |
435 | 461 | ||
436 | /* These are x86-specific, used by some header files */ | 462 | /* These are x86-specific, used by some header files */ |