Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Missing `#[inline]` annotation on the small forwarding function `as_ref` in an abstraction crate. --
commit 61d54b007aa9572681d918fcd5c48802182d8282 Author: Danilo Krummrich <[email protected]> rust: drm: add AsRef<ParentDevice<Bound>> for Device<Registered> This commit implements AsRef<T::ParentDevice<Bound>> for Device<T, Registered>. It provides safe access to the bound parent bus device for registered DRM devices. > diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs > index 45bacd7b227f0..8f63276c9b62f 100644 > --- a/rust/kernel/drm/device.rs > +++ b/rust/kernel/drm/device.rs > @@ -462,6 +462,19 @@ fn as_ref(&self) -> &T::ParentDevice<device::Normal> { > } > } > > +impl<T: drm::Driver> AsRef<T::ParentDevice<device::Bound>> for Device<T, > Registered> { > + fn as_ref(&self) -> &T::ParentDevice<device::Bound> { [Severity: Low] This isn't a bug, but should this small forwarding function in an abstraction crate have an #[inline] annotation? The Rust subsystem coding guidelines mention that functions in abstractions that are small or simply forwarding calls should be annotated with #[inline]. Since as_ref() performs purely type-level conversions and pointer coercions, adding the annotation might help the compiler reliably optimize these across crate boundaries. > + let dev = (**self).as_ref().as_ref(); > + > + // SAFETY: A `Device<T, Registered>` guarantees that the parent > device is bound. > + let dev = unsafe { dev.as_bound() }; > + > + // SAFETY: By the type invariant of `Device`, the parent device is > embedded in > + // `T::ParentDevice`. > + unsafe { device::AsBusDevice::from_device(dev) } > + } > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=13
