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: devres: add DevresLt for ForLt-aware device resource access Date: Thu, 04 Jun 2026 12:08:40 +1000 Message-ID: In-Reply-To: <20260603011020.2073650-6-dakr@kernel.org> References: <20260603011020.2073650-1-dakr@kernel.org> <20260603011020.2073650-6-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 This is the core new abstraction. The `DevresLt` design is clean: ```rust pub struct DevresLt(Devres>) where F::Of<'static>: Send; ``` The `new()` method's use of `pin_init_from_closure` to cast the slot pointe= r is sound =E2=80=94 lifetimes don't affect layout: ```rust let data =3D unsafe { pin_init::pin_init_from_closure::, E>(move |slot| { data.__pinned_init(slot.cast()) }) }; ``` The `DevresGuard` type cleanly wraps `RevocableGuard` with lifetime shorten= ing: ```rust impl<'a, F: CovariantForLt> core::ops::Deref for DevresGuard<'a, F> { type Target =3D F::Of<'a>; fn deref(&self) -> &Self::Target { F::cast_ref(&*self.0) } } ``` **Design question:** `access_with` and `try_access_with` provide `&'a F::Of= <'a>` (non-pinned), while the auxiliary `registration_data_with` provides `= Pin<&'a F::Of<'a>>`. This is consistent with the existing `Devres::access` = API (which returns `&T`, not `Pin<&T>`), but it does mean types that requir= e `Pin` for access (e.g., types with pinned `Mutex` fields whose methods re= quire `Pin<&Self>`) can't use `DevresLt`'s closure accessors directly. If t= his becomes needed, a pinned variant could be added later. Not a blocker fo= r this series since the current consumers (`Bar`, `IoMem`) don't need pinni= ng. **Minor note:** `try_access_with` accesses `self.0.data()` which calls the = private `Devres::data()` method. This works because `DevresLt` is in the sa= me module (`devres.rs`). --- Generated by Claude Code Patch Reviewer