On Fri Jun 5, 2026 at 4:24 AM JST, Lyude Paul wrote: > Just a temporary holdover to make locking/unlocking the dma_resv lock much > easier. > > Signed-off-by: Lyude Paul <[email protected]> > Co-authored-by: Alexandre Courbot <[email protected]> > Signed-off-by: Alexandre Courbot <[email protected]> > > --- > V17: > * Fix format of commit message title > > rust/kernel/drm/gem/shmem.rs | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > > diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs > index 084b798ce795b..650c34dd8b7a4 100644 > --- a/rust/kernel/drm/gem/shmem.rs > +++ b/rust/kernel/drm/gem/shmem.rs > @@ -30,7 +30,10 @@ > Deref, > DerefMut, // > }, > - ptr::NonNull, // > + ptr::{ > + self, > + NonNull, // > + }, > }; > use gem::{ > BaseObjectPrivate, > @@ -244,3 +247,29 @@ impl<T: DriverObject, C: DeviceContext> > driver::AllocImpl for Object<T, C> { > dumb_map_offset: None, > }; > } > + > +/// Private helper-type for holding the `dma_resv` object for a GEM shmem > object. > +/// > +/// When this is dropped, the `dma_resv` lock is dropped as well. > +/// > +// TODO: This should be replace with a WwMutex equivalent once we have such > bindings in the kernel. > +struct DmaResvGuard<'a, T: DriverObject, C: DeviceContext = Registered>(&'a > Object<T, C>);
Should this be made `NotThreadSafe` as suggested by Alice? [1] [1] https://lore.kernel.org/all/[email protected]/
