Re: [PATCH v5 05/10] rust: sync: atomic: Add atomic {cmp,}xchg operations
From: Boqun Feng
Date: Mon Jun 30 2025 - 11:28:16 EST
On Mon, Jun 30, 2025 at 08:24:13AM -0700, Boqun Feng wrote:
[...]
>
> Make senses, so added:
>
> --- a/rust/kernel/sync/atomic/generic.rs
> +++ b/rust/kernel/sync/atomic/generic.rs
> @@ -310,7 +310,7 @@ impl<T: AllowAtomic> Atomic<T>
> /// assert_eq!(42, x.xchg(52, Acquire));
> /// assert_eq!(52, x.load(Relaxed));
> /// ```
> - #[doc(alias("atomic_xchg", "atomic64_xchg"))]
> + #[doc(alias("atomic_xchg", "atomic64_xchg", "swap"))]
> #[inline(always)]
> pub fn xchg<Ordering: Any>(&self, v: T, _: Ordering) -> T {
> let v = T::into_repr(v);
> @@ -382,6 +382,7 @@ pub fn xchg<Ordering: Any>(&self, v: T, _: Ordering) -> T {
> "atomic64_cmpxchg",
> "atomic_try_cmpxchg",
> "atomic64_try_cmpxchg"
Missing a comma here, fixed locally.
Regards,
Boqun
> + "compare_exchange"
> ))]
> #[inline(always)]
> pub fn cmpxchg<Ordering: Any>(&self, mut old: T, new: T, o: Ordering) -> Result<T, T> {
>
> Seems good?
>
> Regards,
> Boqun