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: Higher-Ranked Lifetime Types for device drivers Date: Mon, 25 May 2026 19:29:12 +1000 Message-ID: In-Reply-To: <20260521233501.1191842-1-dakr@kernel.org> References: <20260521233501.1191842-1-dakr@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Overall Series Review Subject: rust: device: Higher-Ranked Lifetime Types for device drivers Author: Danilo Krummrich Patches: 35 Reviewed: 2026-05-25T19:29:12.760265 --- This is a well-designed, ambitious 27-patch series by Danilo Krummrich (with foundational contributions from Gary Guo) that introduces **Higher-Ranked Lifetime Types (HRT)** into the Rust device driver framework. The core idea is elegant: by making driver private data generic over a `'bound` lifetime tied to the device binding scope, drivers can hold direct `&'bound` references to device resources (PCI BARs, IoMem mappings, etc.) instead of going through `Devres` wrappers with runtime revocation checks. **Key strengths:** - The GAT-based `type Data<'bound>` approach (introduced in v3/v4) is significantly cleaner than parameterizing the entire Driver trait. - The series is carefully ordered: foundational trait changes first, then bus-specific implementations, then resource lifetime-parameterization, then driver examples. - The `ForLt` macro implementation with compile-time covariance proofs is thorough. - Real-world drivers (nova-core, tyr) demonstrate concrete benefits: eliminated `Arc>` indirection, infallible register access, Drop-based cleanup replacing manual `unbind()`. **Key concerns:** - Patch 4 (C-side reorder of `post_unbind_rust` before `devres_release_all`) is the soundness linchpin for the entire series and affects all Rust drivers, not just HRT-using ones. - Several uses of `core::mem::transmute` to erase/extend lifetimes require careful scrutiny. - Patch 24's self-referential `unsafe { &*core::ptr::from_ref(bar) }` in `try_pin_init!` is a known gap waiting for pin-init syntax support, but is a subtle soundness argument. Overall this is high-quality work. The series is at v4 and already has Reviewed-by tags from multiple reviewers. Below are detailed per-patch observations. --- --- Generated by Claude Code Patch Reviewer