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

From: Stephen Rothwell <[email-masked]>
Date: Fri, 21 Mar 2025 18:56:30 +1100

Hi all,

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

  samples/rust/rust_dma.rs

between commit:

  7b948a2af6b5 ("rust: pci: fix unrestricted &mut pci::Device")

from the driver-core tree and commit:

  9901addae63b ("samples: rust: add Rust dma test sample driver")

from the rust tree.

I fixed it up (I applied the following supplied resolution, thanks Danilo)
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.

From: Stephen Rothwell <[email-masked]>
Date: Fri, 21 Mar 2025 18:21:27 +1100
Subject: [PATCH] fix up for "samples: rust: add Rust dma test sample driver"

interacting with commit

  7b948a2af6b5 ("rust: pci: fix unrestricted &mut pci::Device")

from the driver-core tree.

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 samples/rust/rust_dma.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/samples/rust/rust_dma.rs b/samples/rust/rust_dma.rs
index 908acd34b8db..874c2c964afa 100644
--- a/samples/rust/rust_dma.rs
+++ b/samples/rust/rust_dma.rs
@@ -4,10 +4,10 @@
 //!
 //! To make this driver probe, QEMU must be run with `-device pci-testdev`.
 
-use kernel::{bindings, dma::CoherentAllocation, pci, prelude::*};
+use kernel::{bindings, device::Core, dma::CoherentAllocation, pci, prelude::*, types::ARef};
 
 struct DmaSampleDriver {
-    pdev: pci::Device,
+    pdev: ARef<pci::Device>,
     ca: CoherentAllocation<MyStruct>,
 }
 
@@ -48,7 +48,7 @@ impl pci::Driver for DmaSampleDriver {
     type IdInfo = ();
     const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE;
 
-    fn probe(pdev: &mut pci::Device, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> {
+    fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> {
         dev_info!(pdev.as_ref(), "Probe DMA test driver.\n");
 
         let ca: CoherentAllocation<MyStruct> =
@@ -64,7 +64,7 @@ fn probe(pdev: &mut pci::Device, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>
 
         let drvdata = KBox::new(
             Self {
-                pdev: pdev.clone(),
+                pdev: pdev.into(),
                 ca,
             },
             GFP_KERNEL,
-- 
2.45.2

-- 
Cheers,
Stephen Rothwell