Re: [PATCH v2 3/5] rust: drm: gem: shmem: Implement prime_import_sg_table callback

From: Janne Grunau

Date: Wed Nov 25 2026 - 06:38:57 EST


On Tue, Nov 24, 2026 at 04:53:03PM +0000, Alice Ryhl wrote:
> On Tue, Nov 24, 2026 at 12:37:45PM +0100, Janne Grunau wrote:
> > + // SAFETY: The DRM shmem helper only invokes this callback for a registered DRM device of
> > + // type `T::Driver`, which is `Self`'s driver per the `AllocImpl` impl below.
> > + let dev: &Device<T::Driver> = unsafe { Device::from_raw(raw_dev) };
>
> `drm::Driver` in `rust/kernel/drm/driver.rs` currently declares:
>
> type Object: AllocImpl;
>
> without any constraint that `T::Object::Driver = T`. I think we should
> introduce one similar to how Driver::File constrains this?

so changing it to `type Object: AllocImpl<Driver = Self>;`?

I think it's hard to get that accidentally wrong but since the change
relies on that constraint and we can express it sure.

I added it locally for v3 but feel free to make that change before
pushing this series to drm-rust-next if there is nothing else that
warrants a v3.

Janne