Re: [PATCH] rust: dma: add `Send` implementation for `CoherentAllocation`

From: Miguel Ojeda
Date: Mon Mar 24 2025 - 18:38:30 EST


On Mon, Mar 24, 2025 at 6:41 PM Miguel Ojeda <ojeda@xxxxxxxxxx> wrote:
>
> From: Danilo Krummrich <dakr@xxxxxxxxxx>
>
> Stephen found a future build failure in linux-next [1]:
>
> error[E0277]: `*mut MyStruct` cannot be sent between threads safely
> --> samples/rust/rust_dma.rs:47:22
> |
> 47 | impl pci::Driver for DmaSampleDriver {
> | ^^^^^^^^^^^^^^^ `*mut MyStruct` cannot be sent between threads safely
>
> It is caused by the interaction between commit 935e1d90bf6f ("rust: pci:
> require Send for Driver trait implementers") from the driver-core tree,
> which fixes a missing concurrency requirement, and commit 9901addae63b
> ("samples: rust: add Rust dma test sample driver") which adds a sample
> that does not satisfy that requirement.
>
> Add a `Send` implementation to `CoherentAllocation`, which allows the
> sample (and other future users) to satisfy it.
>
> Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/linux-next/20250324215702.1515ba92@xxxxxxxxxxxxxxxx/
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>

Applied to `rust-next` -- thanks everyone!

[ Added number to Closes. Fix typo spotted by Boqun. - Miguel ]

Cheers,
Miguel