Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Missing `#[inline]` annotations on small abstraction methods `value` and `value_ref` in `ModuleParamAccess`. --
commit 6103e7f86e2528da9d35cfda1b1a7d24ab1f6516 Author: Andreas Hindborg <[email protected]> rust: module_param: return value by copy from value For Copy parameter types, this patch changes ModuleParamAccess::value to return by copy instead of by reference, improving ergonomics. It also renames the reference-returning accessor to value_ref and updates the caller in rust_minimal. > diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs > index 6a8a7a875643a..701210206bba5 100644 > --- a/rust/kernel/module_param.rs > +++ b/rust/kernel/module_param.rs > @@ -132,9 +132,12 @@ pub const fn new(default: T) -> Self { > } > > /// Get a shared reference to the parameter value. > + /// > + /// Returns a reference to the value supplied at module load time, or a > + /// reference to the default value if the parameter has not been set. > // Note: When sysfs access to parameters are enabled, we have to pass in > a > // held lock guard here. > - pub fn value(&self) -> &T { > + pub fn value_ref(&self) -> &T { [Severity: Low] This isn't a bug, but according to the Rust subsystem coding guidelines, functions in abstractions that are small or forward to binding calls should be annotated with #[inline]. Should value_ref() have an #[inline] annotation added here? > self.value.as_ref().unwrap_or(&self.default) > } [ ... ] > @@ -146,6 +149,16 @@ pub const fn as_void_ptr(&self) -> *mut c_void { > } > } > > +impl<T: Copy> ModuleParamAccess<T> { > + /// Get a copy of the parameter value. > + /// > + /// Returns the value supplied at module load time, or the default value > + /// if the parameter has not been set. > + pub fn value(&self) -> T { [Severity: Low] This isn't a bug, but similar to the above, should this small abstraction method also be marked with #[inline] to allow compiler optimizations across crate boundaries? > + self.value.copy().unwrap_or(self.default) > + } > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
