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

From: Stephen Rothwell <[email-masked]>
Date: Tue, 1 Jul 2025 17:46:06 +1000

Hi all,

Today's linux-next merge of the rust tree got a conflict in:

  rust/kernel/devres.rs

between commits:

  0dab138d0f4c ("rust: devres: require T: Send for Devres")
  ce7c22b2e1fb ("rust: revocable: support fallible PinInit types")
  46ae8fd7386a ("rust: devres: replace Devres::new_foreign_owned()")
  f5d3ef25d238 ("rust: devres: get rid of Devres' inner Arc")

from the driver-core tree and commits:

  fcad9bbf9e1a ("rust: enable `clippy::ptr_as_ptr` lint")
  23773bd8da71 ("rust: enable `clippy::as_ptr_cast_mut` lint")
  5e30550558b1 ("rust: enable `clippy::as_underscore` lint")
  b6985083be1d ("rust: Use consistent "# Examples" heading style in rustdoc")

from the rust tree.

Maybe not all the above commits are involved ...

I used the former version (since it changed things so much) and then
added the changes from the latter by hand where I could.  I ended up
with the below diff compared to te HEAD before the merge.

I fixed it up (see below) and can carry the fix as necessary. 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 --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs
index 7c5c5de8bcb6..f900433f5296 100644
--- a/rust/kernel/devres.rs
+++ b/rust/kernel/devres.rs
@@ -49,7 +49,7 @@ struct Inner<T: Send> {
 /// [`Devres`] users should make sure to simply free the corresponding backing resource in `T`'s
 /// [`Drop`] implementation.
 ///
-/// # Example
+/// # Examples
 ///
 /// ```no_run
 /// # use kernel::{bindings, c_str, device::{Bound, Device}, devres::Devres, io::{Io, IoRaw}};
@@ -66,19 +66,19 @@ struct Inner<T: Send> {
 ///     unsafe fn new(paddr: usize) -> Result<Self>{
 ///         // SAFETY: By the safety requirements of this function [`paddr`, `paddr` + `SIZE`) is
 ///         // valid for `ioremap`.
-///         let addr = unsafe { bindings::ioremap(paddr as _, SIZE as _) };
+///         let addr = unsafe { bindings::ioremap(paddr as bindings::phys_addr_t, SIZE) };
 ///         if addr.is_null() {
 ///             return Err(ENOMEM);
 ///         }
 ///
-///         Ok(IoMem(IoRaw::new(addr as _, SIZE)?))
+///         Ok(IoMem(IoRaw::new(addr as usize, SIZE)?))
 ///     }
 /// }
 ///
 /// impl<const SIZE: usize> Drop for IoMem<SIZE> {
 ///     fn drop(&mut self) {
 ///         // SAFETY: `self.0.addr()` is guaranteed to be properly mapped by `Self::new`.
-///         unsafe { bindings::iounmap(self.0.addr() as _); };
+///         unsafe { bindings::iounmap(self.0.addr() as *mut c_void); };
 ///     }
 /// }
 ///
@@ -214,7 +214,7 @@ fn remove_action(&self) -> bool {
     /// An error is returned if `dev` does not match the same [`Device`] this [`Devres`] instance
     /// has been created with.
     ///
-    /// # Example
+    /// # Examples
     ///
     /// ```no_run
     /// # #![cfg(CONFIG_PCI)]