diff options
Diffstat (limited to 'scripts/atomic/fallbacks/try_cmpxchg')
-rwxr-xr-x | scripts/atomic/fallbacks/try_cmpxchg | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/atomic/fallbacks/try_cmpxchg b/scripts/atomic/fallbacks/try_cmpxchg index 890f850ede37..77f0fa1eeeb1 100755 --- a/scripts/atomic/fallbacks/try_cmpxchg +++ b/scripts/atomic/fallbacks/try_cmpxchg @@ -1,3 +1,20 @@ +if /bin/sh ${ATOMICDIR}/chkdup.sh arch_${atomic}_try_cmpxchg${order} try_cmpxchg +then +cat <<EOF +/** + * arch_${atomic}_try_cmpxchg${order} - Atomic cmpxchg with bool return value + * @v: pointer of type ${atomic}_t + * @old: desired old value to match + * @new: new value to put in + * + * Atomically compares @new to *@v, and if equal, stores @new to *@v, + * providing ${docbook_order} ordering. + * Returns @true if the cmpxchg operation succeeded, and @false otherwise. + * On failure, stores the original value of *@v into *@old, which permits + * a retry without a reload from *@v. + */ +EOF +fi cat <<EOF static __always_inline bool arch_${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new) |