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: device: generalize drvdata methods over ForLt Date: Tue, 28 Apr 2026 13:47:57 +1000 Message-ID: In-Reply-To: <20260427221155.2144848-5-dakr@kernel.org> References: <20260427221155.2144848-1-dakr@kernel.org> <20260427221155.2144848-5-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 The most safety-critical patch in the core infrastructure. Key observations: In `set_drvdata`: ```rust let ptr = KBox::into_raw(unsafe { Pin::into_inner_unchecked(data) }); ``` This replaces the previous `into_foreign()` path. The safety comment about lifetime erasure not affecting layout is correct. In `drvdata_obtain`: ```rust Some(unsafe { Pin::new_unchecked(KBox::from_raw(ptr.cast())) }) ``` This correctly reconstructs with the borrow lifetime of `&self` rather than `'static`. In `drvdata_unchecked`, the two-step pattern of borrowing as `'static` then casting via `ForLt::cast_ref` is sound. The `where F::Of<'static>: 'static` bounds look tautological but are needed for the compiler to see through the associated type. --- Generated by Claude Code Patch Reviewer