From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: rust: pci: make Bar lifetime-parameterized Date: Thu, 07 May 2026 13:02:05 +1000 Message-ID: In-Reply-To: <20260506215113.851360-18-dakr@kernel.org> References: <20260506215113.851360-1-dakr@kernel.org> <20260506215113.851360-18-dakr@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review Key change: `Bar` becomes `Bar<'bound, SIZE>` holding `&'bound Device` instead of `ARef`. The `into_devres` method: ```rust pub fn into_devres(self) -> Result>> { let bar: Bar<'static, SIZE> = unsafe { core::mem::transmute(self) }; let pdev = bar.pdev; Devres::new(pdev.as_ref(), bar) } ``` The `transmute` from `Bar<'bound, SIZE>` to `Bar<'static, SIZE>` is sound because: 1. The only difference is the lifetime on the `&Device` reference, which doesn't affect layout 2. `Devres` manages the resource's actual lifetime via revocation, not Rust lifetimes 3. After `into_devres`, access goes through `Devres::access()` which checks device binding **Minor note:** After the transmute, `bar.pdev` is a `&'static Device`. This is used to call `Devres::new(pdev.as_ref(), bar)` which needs a `&Device`. The `'static` reference is being used transiently here, which is fine since the `Devres` will manage the actual lifetime. But worth noting that this creates a brief `&'static` reference to the device, which is technically valid since the device does exist at this point. --- Generated by Claude Code Patch Reviewer