mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
fix arch_try_cmpxchg macro declaration (#307)
fix arch_try_cmpxchg in atomic_cmpxchg Co-authored-by: Yao Zhao <dragonlinux@gmail.com>
This commit is contained in:
@ -77,7 +77,7 @@ extern void __cmpxchg_wrong_size(void) __compiletime_error("Bad argument size fo
|
||||
likely(is_success); \
|
||||
})
|
||||
|
||||
#define arch_try_cmpxchg(ptr, old_ptr, new_ptr) \
|
||||
__raw_try_cmpxchg((ptr), (old_ptr), (new_ptr), sizeof(*ptr))
|
||||
#define arch_try_cmpxchg(ptr, old_ptr, new) \
|
||||
__raw_try_cmpxchg((ptr), (old_ptr), (new), sizeof(*ptr))
|
||||
|
||||
bool __try_cmpxchg_q(uint64_t *ptr, uint64_t *old_ptr, uint64_t *new_ptr);
|
||||
bool __try_cmpxchg_q(uint64_t *ptr, uint64_t *old_ptr, uint64_t *new_ptr);
|
||||
|
@ -102,6 +102,6 @@ inline void atomic_clear_mask(atomic_t *ato, long mask)
|
||||
// cmpxchgq 比较并交换
|
||||
inline long atomic_cmpxchg(atomic_t *ato, long oldval, long newval)
|
||||
{
|
||||
bool success = arch_try_cmpxchg(&ato->value, &oldval, &newval);
|
||||
bool success = arch_try_cmpxchg(&ato->value, &oldval, newval);
|
||||
return success ? oldval : newval;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user