Re: [PATCH 1/2] rust: pci: impl Send + Sync for pci::Device
From: Alice Ryhl
Date: Wed Mar 19 2025 - 09:17:04 EST
On Wed, Mar 19, 2025 at 01:47:01PM +0100, Danilo Krummrich wrote:
> On Wed, Mar 19, 2025 at 12:05:13PM +0000, Alice Ryhl wrote:
> > On Tue, Mar 18, 2025 at 10:29:21PM +0100, Danilo Krummrich wrote:
> > > Commit 7b948a2af6b5 ("rust: pci: fix unrestricted &mut pci::Device")
> > > changed the definition of pci::Device and discarded the implicitly
> > > derived Send and Sync traits.
> > >
> > > This isn't required by upstream code yet, and hence did not cause any
> > > issues. However, it is relied on by upcoming drivers, hence add it back
> > > in.
> > >
> > > Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> >
> > I have a question related to this ... does the Driver trait need to
> > require T: Send?
>
> The driver trait does not have a generic, it doesn't need one. But I think I
> still get what you're asking.
Right I mean, should it be:
trait Driver: Send + Sync {
...
}
> The driver trait never owns a shared reference of the device, it only ever gives
> out a reference that the driver core guarantees to be valid.
>
> > The change itself LGTM, so:
> >
> > Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> >
> > Alice