Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] rust: reset: missing #[inline] on
  ExclusiveResetControl::get_array_internal()
--

commit 5faf22f79dec9848d60fc84ac341d26a05013a7f
Author: Daniel Almeida <[email protected]>

rust: reset: add ExclusiveResetControl::get_array() and get_array_optional()

This commit adds ExclusiveResetControl::get_array() and get_array_optional()
to acquire all reset lines listed in a device's resets property as a single
reset control.

> diff --git a/rust/kernel/reset.rs b/rust/kernel/reset.rs
> index 396f1e19ee2e3..7ca83f2d6abf1 100644
> --- a/rust/kernel/reset.rs
> +++ b/rust/kernel/reset.rs
[ ... ]
> @@ -213,6 +219,92 @@ pub fn get_optional(dev: &'a Device<Bound>, name: 
> Option<&CStr>) -> Result<Self>
>              _phantom: PhantomData,
>          })
>      }
> +
> +    /// Gets the reset lines of `dev` as one [`ExclusiveResetControl`], as 
> [`Self::get_array`] does
> +    /// or, if `optional` is set, as [`Self::get_array_optional`] does.
> +    fn get_array_internal(dev: &'a Device<Bound>, optional: bool) -> 
> Result<Self> {
> +        let flags = if optional {
> +            bindings::reset_control_flags_RESET_CONTROL_OPTIONAL_EXCLUSIVE
> +        } else {
> +            bindings::reset_control_flags_RESET_CONTROL_EXCLUSIVE
> +        };
> +
> +        let fwnode = dev
> +            .fwnode()
> +            .map_or(ptr::null_mut(), |fwnode| fwnode.as_raw());
> +
> +        // SAFETY: `fwnode` is the firmware node of `dev` or `NULL`, which
> +        // `fwnode_reset_control_array_get()` checks for.
> +        let inner = unsafe { 
> bindings::fwnode_reset_control_array_get(fwnode, flags) };
> +        let inner = from_err_ptr(inner)?;
> +
> +        // INVARIANT: `inner` comes from a successful call to 
> `fwnode_reset_control_array_get()`
> +        // with one of the two flags above, and the returned value owns the 
> reference from that
> +        // call.
> +        Ok(Self {
> +            inner,
> +            _phantom: PhantomData,
> +        })
> +    }

[Severity: Low]
Should get_array_internal() be marked #[inline]?  Like the other small C
binding wrappers in this module, it forwards directly to
bindings::fwnode_reset_control_array_get(), and without #[inline]
cross-crate calls to the #[inline] get_array() and get_array_optional()
methods cannot inline it or constant-fold the optional flag.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to