Re: [PATCH 1/4] drm/tyr: name resource lifetimes after their types
From: Gary Guo
Date: Wed Nov 18 2026 - 21:08:46 EST
On Wed Nov 18, 2026 at 11:37 PM GMT, Danilo Krummrich wrote:
> The firmware, buffer, VM and MMU types use 'drm for their resource
> lifetimes, even though each parameter is local to its type.
This doesn't make any sense, a lifetime on a type by definition cannot refer to
a scope of itself.
`'sec` is not the lifetime of `Section` and `'fw` is not the lifetime of
`Firmware` and I think this is just confusing.
Best,
Gary
>
> Rename these parameters to reflect the respective type's scope in
> preparation for converting the resource ownership to self-referential
> pin-init.
>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> drivers/gpu/drm/tyr/fw.rs | 26 +++++++--------
> drivers/gpu/drm/tyr/gem.rs | 8 ++---
> drivers/gpu/drm/tyr/mmu.rs | 24 +++++++-------
> drivers/gpu/drm/tyr/mmu/address_space.rs | 30 ++++++++---------
> drivers/gpu/drm/tyr/vm.rs | 42 ++++++++++++------------
> 5 files changed, 65 insertions(+), 65 deletions(-)
>
> diff --git a/drivers/gpu/drm/tyr/fw.rs b/drivers/gpu/drm/tyr/fw.rs
> index aea151ff1f93..16c6aca3d3f1 100644
> --- a/drivers/gpu/drm/tyr/fw.rs
> +++ b/drivers/gpu/drm/tyr/fw.rs
> @@ -131,7 +131,7 @@ fn try_from_fw(value: u32) -> Result<Self> {
> }
>
> /// A parsed section of the firmware binary.
> -struct Section<'drm> {
> +struct Section<'sec> {
> // Raw firmware section data for reset purposes
> #[expect(dead_code)]
> data: KVec<u8>,
> @@ -139,23 +139,23 @@ struct Section<'drm> {
> // Keep the BO backing this firmware section so that both the
> // GPU mapping and CPU mapping remain valid until the Section is dropped.
> #[expect(dead_code)]
> - mem: gem::KernelBo<'drm>,
> + mem: gem::KernelBo<'sec>,
> }
>
> /// Loaded firmware with sections mapped into MCU VM.
> -pub(crate) struct Firmware<'drm> {
> +pub(crate) struct Firmware<'fw> {
> /// Iomem need to access registers.
> - iomem: Arc<IoMem<'drm>>,
> + iomem: Arc<IoMem<'fw>>,
>
> /// MCU VM.
> - vm: Arc<Vm<'drm>>,
> + vm: Arc<Vm<'fw>>,
>
> /// List of firmware sections.
> #[expect(dead_code)]
> - sections: KVec<Section<'drm>>,
> + sections: KVec<Section<'fw>>,
> }
>
> -impl<'drm> Drop for Firmware<'drm> {
> +impl<'fw> Drop for Firmware<'fw> {
> fn drop(&mut self) {
> // Stop the MCU before releasing its firmware mappings and memory.
> let _ = self.stop();
> @@ -165,8 +165,8 @@ fn drop(&mut self) {
> }
> }