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: make Core and CoreInternal lifetime-parameterized Date: Tue, 26 May 2026 06:47:03 +1000 Message-ID: In-Reply-To: <20260525202921.124698-12-dakr@kernel.org> References: <20260525202921.124698-1-dakr@kernel.org> <20260525202921.124698-12-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 Changes `Core` and `CoreInternal` from unit structs to lifetime-parameterized: ```rust -pub struct Core; +pub struct Core<'a>(PhantomData<&'a ()>); -pub struct CoreInternal; +pub struct CoreInternal<'a>(PhantomData<&'a ()>); ``` Updates the `__impl_device_context_deref` and `__impl_device_context_into_aref` macros with new lifetime-parameterized variants. This is a large but mechanical change that touches all probe/unbind signatures across all buses and samples to use `Core<'_>`. The `dma::Device` trait also becomes lifetime-parameterized. New macro variants handle the lifetime properly: ```rust + (unsafe { $device:ident, <$lt:lifetime> $src:ty => $dst:ty }) => { + impl<$lt> ::core::ops::Deref for $device<$src> { ``` Well-structured. No issues. ### PATCHES 12-16: make Driver trait lifetime-parameterized (PCI, platform, auxiliary, USB, I2C) Each patch follows the same pattern. For PCI (patch 12) as representative: ```rust - type Data: Send; + type Data<'bound>: Send + 'bound; ... - fn probe(dev: &Device>, id_info: &Self::IdInfo) - -> impl PinInit; + fn probe<'bound>( + dev: &'bound Device>, + id_info: &'bound Self::IdInfo, + ) -> impl PinInit, Error> + 'bound; ``` The `'bound` lifetime is introduced on the method rather than the trait, avoiding a global trait lifetime. The `+ 'bound` on the return type allows the initializer to capture references from the arguments. The `unbind` signature gains the same pattern. SAFETY comments updated to reference `T::Data<'_>`. The I2C patch (16) also handles `shutdown` callback. USB patch (15) handles `disconnect`. All consistent. Each existing driver sets `type Data<'bound> = Self`, preserving behavior. --- Generated by Claude Code Patch Reviewer