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: Mon, 25 May 2026 19:29:14 +1000 Message-ID: In-Reply-To: <20260521233501.1191842-18-dakr@kernel.org> References: <20260521233501.1191842-1-dakr@kernel.org> <20260521233501.1191842-18-dakr@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review Converts `Bar` to `Bar<'a, SIZE>`, storing `&'a Device` instea= d of `ARef`. The `iomap_region_sized()` method now returns `Result<= Bar<'a, SIZE>>` directly instead of `impl PinInit>, Error>= `. The notable addition is `Bar::into_devres()`: ```rust pub fn into_devres(self) -> Result>> { let bar: Bar<'static, SIZE> =3D unsafe { core::mem::transmute(self) }; let pdev =3D bar.pdev; Devres::new(pdev.as_ref(), bar) } ``` The transmute to `'static` is justified by the Devres invariant: access is = revoked on unbind, so the Bar never actually outlives the device. The safet= y comment is clear. **Minor observation:** After the transmute, `bar.pdev` is read as a `&'stat= ic Device`. While this is fine because the Devres owns the Bar and t= he device outlives the Devres, the code derives `pdev` from the already-tra= nsmuted `bar` =E2=80=94 this means `pdev` is a `&'static` reference being p= assed to `Devres::new()`. Since Devres ties the resource to the device and = the device *does* outlive the Devres, this should be sound, but worth notin= g for reviewers. --- --- Generated by Claude Code Patch Reviewer