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, 18 May 2026 16:24:35 +1000 Message-ID: In-Reply-To: <20260517000149.3226762-20-dakr@kernel.org> References: <20260517000149.3226762-1-dakr@kernel.org> <20260517000149.3226762-20-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 Adds a method to convert a lifetime-parameterized `Bar` into a `Devres= ` for cases where runtime revocation is still needed: ```rust + pub fn into_devres(self) -> impl PinInit>, E= rror> + use<'bound, SIZE> + where + Bar<'bound, SIZE>: Send + Sync, + { + Devres::new_foreign_owned(self.pdev.as_ref(), unsafe { + core::mem::transmute::, Bar<'static, SIZE>>(= self) + }) ``` **Key unsafe:** The `transmute` from `Bar<'bound>` to `Bar<'static>` erases= the lifetime. This is sound because `Devres` guarantees revocation before = the device unbinds (which is when `'bound` ends). The safety comment explai= ns this well. The `where Bar<'bound, SIZE>: Send + Sync` bound is important= =E2=80=94 it prevents unsound transmutes of non-thread-safe types. --- Generated by Claude Code Patch Reviewer