/* Atomically xchgs the value of @ptr to @new_val and returns the old value.  */
u64 atomic64_xchg(atomic64_t *ptr, u64 new_val)
/* Atomically xchgs the value of @ptr to @new_val and returns the old value.  */
u64 atomic64_xchg(atomic64_t *ptr, u64 new_val)
{
	u64 old_val, real_val = 0;
	do {
		old_val = real_val;
		real_val = atomic64_cmpxchg(ptr, old_val, new_val);
	} while (real_val != old_val);
	return old_val;
}