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

Stephen Rothwell posted 1 patch 10 months, 3 weeks ago
There is a newer version of this series
samples/rust/rust_dma.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
linux-next: manual merge of the rust tree with the driver-core tree
Posted by Stephen Rothwell 10 months, 3 weeks ago
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 <sfr@canb.auug.org.au>
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 <sfr@canb.auug.org.au>
---
 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
Re: linux-next: manual merge of the rust tree with the driver-core tree
Posted by Stephen Rothwell 10 months, 2 weeks ago
Hi all,

On Fri, 21 Mar 2025 18:56:30 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> 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 <sfr@canb.auug.org.au>
> 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 <sfr@canb.auug.org.au>
> ---
>  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

This is now a conflict between the driver-core tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell
Re: linux-next: manual merge of the rust tree with the driver-core tree
Posted by Greg KH 10 months, 2 weeks ago
On Tue, Apr 01, 2025 at 02:21:59PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> On Fri, 21 Mar 2025 18:56:30 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > 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 <sfr@canb.auug.org.au>
> > 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 <sfr@canb.auug.org.au>
> > ---
> >  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
> 
> This is now a conflict between the driver-core tree and Linus' tree.

Thanks, I've sent the pull request to Linus right after the rust one,
and warned him about this conflict.

greg k-h
Re: linux-next: manual merge of the rust tree with the driver-core tree
Posted by Miguel Ojeda 10 months, 3 weeks ago
On Fri, Mar 21, 2025 at 8:56 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> 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.

Looks like it worked from my test builds, thanks!

Cheers,
Miguel