From 34d76d977323fa76c3b605a98a7f521576c8c019 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Tue, 7 Apr 2009 11:30:17 +0200 Subject: [PATCH] --- yaml --- r: 147339 b: refs/heads/master c: 98c2aaf8be5baf7193be37fb28bce8e7327158bc h: refs/heads/master i: 147337: 2cfc917a2a3429b09f2d5e94d77efe2e82717a78 147335: 0c64bda46d41b99f4bf958d510b72219fb8abcd7 v: v3 --- [refs] | 2 +- trunk/arch/x86/include/asm/atomic_32.h | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 3b18f92264e2..719c8eccec21 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6278af660ff83fbafb18e53fc2747eb2ee6780fa +refs/heads/master: 98c2aaf8be5baf7193be37fb28bce8e7327158bc diff --git a/trunk/arch/x86/include/asm/atomic_32.h b/trunk/arch/x86/include/asm/atomic_32.h index 977250ed8b89..aff9f1fcdcd7 100644 --- a/trunk/arch/x86/include/asm/atomic_32.h +++ b/trunk/arch/x86/include/asm/atomic_32.h @@ -291,19 +291,37 @@ atomic64_cmpxchg(atomic64_t *ptr, unsigned long long old_val, } /** - * atomic64_set - set atomic64 variable + * atomic64_xchg - xchg atomic64 variable * @ptr: pointer to type atomic64_t * @new_val: value to assign + * @old_val: old value that was there * - * Atomically sets the value of @ptr to @new_val. + * Atomically xchgs the value of @ptr to @new_val and returns + * the old value. */ -static inline void atomic64_set(atomic64_t *ptr, unsigned long long new_val) + +static inline unsigned long long +atomic64_xchg(atomic64_t *ptr, unsigned long long new_val) { unsigned long long old_val; do { old_val = atomic_read(ptr); } while (atomic64_cmpxchg(ptr, old_val, new_val) != old_val); + + return old_val; +} + +/** + * atomic64_set - set atomic64 variable + * @ptr: pointer to type atomic64_t + * @new_val: value to assign + * + * Atomically sets the value of @ptr to @new_val. + */ +static inline void atomic64_set(atomic64_t *ptr, unsigned long long new_val) +{ + atomic64_xchg(ptr, new_val); } /**