Subject: Re: linux-next: manual merge of the driver-core tree with the tip tree

From: Boqun Feng <[email-masked]>
Date: Mon, 17 Nov 2025 13:34:44 -0800

On Mon, Nov 17, 2025 at 04:30:33PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the driver-core tree got conflicts in:
> 
>   samples/rust/rust_debugfs.rs
>   samples/rust/rust_debugfs_scoped.rs
> 
> between commit:
> 
>   f74cf399e02e ("rust: debugfs: Replace the usage of Rust native atomics")
> 
> from the tip tree and commits:
> 
>   0242623384c7 ("rust: driver: let probe() return impl PinInit<Self, Error>")
>   52af0c37964b ("samples: rust: debugfs: add example for blobs")
>   f656279afde1 ("samples: rust: debugfs_scoped: add example for blobs")
> 
> from the driver-core tree.
> 
> I fixed it up (I think - see below) and can carry the fix as necessary.

Again, this fix looks good to me. Thanks!

Regards,
Boqun

> This is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc samples/rust/rust_debugfs.rs
> index 711faa07bece,c45b568d951b..000000000000
> --- a/samples/rust/rust_debugfs.rs
> +++ b/samples/rust/rust_debugfs.rs
> @@@ -36,8 -38,9 +36,9 @@@ use kernel::c_str
>   use kernel::debugfs::{Dir, File};
>   use kernel::new_mutex;
>   use kernel::prelude::*;
> + use kernel::sizes::*;
>  +use kernel::sync::atomic::{Atomic, Relaxed};
>   use kernel::sync::Mutex;
>  -
>   use kernel::{acpi, device::Core, of, platform, str::CString, types::ARef};
>   
>   kernel::module_platform_driver! {
> @@@ -57,9 -60,13 +58,13 @@@ struct RustDebugFs 
>       #[pin]
>       _compatible: File<CString>,
>       #[pin]
>  -    counter: File<AtomicUsize>,
>  +    counter: File<Atomic<usize>>,
>       #[pin]
>       inner: File<Mutex<Inner>>,
> +     #[pin]
> +     array_blob: File<Mutex<[u8; 4]>>,
> +     #[pin]
> +     vector_blob: File<Mutex<KVec<u8>>>,
>   }
>   
>   #[derive(Debug)]
> @@@ -104,16 -111,17 +109,17 @@@ impl platform::Driver for RustDebugFs 
>       fn probe(
>           pdev: &platform::Device<Core>,
>           _info: Option<&Self::IdInfo>,
> -     ) -> Result<Pin<KBox<Self>>> {
> -         let result = KBox::try_pin_init(RustDebugFs::new(pdev), GFP_KERNEL)?;
> -         // We can still mutate fields through the files which are atomic or mutexed:
> -         result.counter.store(91, Relaxed);
> -         {
> -             let mut guard = result.inner.lock();
> -             guard.x = guard.y;
> -             guard.y = 42;
> -         }
> -         Ok(result)
> +     ) -> impl PinInit<Self, Error> {
> +         RustDebugFs::new(pdev).pin_chain(|this| {
>  -            this.counter.store(91, Ordering::Relaxed);
> ++            this.counter.store(91, Relaxed);
> +             {
> +                 let mut guard = this.inner.lock();
> +                 guard.x = guard.y;
> +                 guard.y = 42;
> +             }
> + 
> +             Ok(())
> +         })
>       }
>   }
>   
> diff --cc samples/rust/rust_debugfs_scoped.rs
> index 9f0ec5f24cda,c80312cf168d..000000000000
> --- a/samples/rust/rust_debugfs_scoped.rs
> +++ b/samples/rust/rust_debugfs_scoped.rs
> @@@ -6,9 -6,10 +6,10 @@@
>   //! `Scope::dir` to create a variety of files without the need to separately
>   //! track them all.
>   
>  -use core::sync::atomic::AtomicUsize;
>   use kernel::debugfs::{Dir, Scope};
>   use kernel::prelude::*;
> + use kernel::sizes::*;
>  +use kernel::sync::atomic::Atomic;
>   use kernel::sync::Mutex;
>   use kernel::{c_str, new_mutex, str::CString};
>   
> @@@ -109,7 -114,8 +114,8 @@@ impl ModuleData 
>   
>   struct DeviceData {
>       name: CString,
>  -    nums: KVec<AtomicUsize>,
>  +    nums: KVec<Atomic<usize>>,
> +     blob: Pin<KBox<Mutex<[u8; SZ_4K]>>>,
>   }
>   
>   fn init_control(base_dir: &Dir, dyn_dirs: Dir) -> impl PinInit<Scope<ModuleData>> + '_ {