]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: auxiliary: generalize Registration over ForLt
authorDanilo Krummrich <dakr@kernel.org>
Mon, 25 May 2026 20:21:10 +0000 (22:21 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 27 May 2026 14:27:28 +0000 (16:27 +0200)
commit4555291ddae9abe2c40a7eae192b1976b07a1fad
tree8418932505f646ddb7758774938f01c81fba0983
parente189bdb687a56bcf389798f1d3a2f261fff2ef54
rust: auxiliary: generalize Registration over ForLt

Generalize Registration<T> to Registration<F: ForLt> and
Device::registration_data<F: ForLt>() to return Pin<&F::Of<'_>>.

The stored 'static lifetime is shortened to the borrow lifetime of &self
via ForLt::cast_ref; ForLt's covariance guarantee makes this sound.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260525202921.124698-24-dakr@kernel.org
[ Use PhantomData<F::Of<'a>> instead of
  PhantomData<(fn(&'a ()) -> &'a (), F)>], which also gets us rid of
  #[allow(clippy::type_complexity)]. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/nova-core/driver.rs
rust/kernel/auxiliary.rs
samples/rust/rust_driver_auxiliary.rs