dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Almeida" <daniel.almeida@collabora.com>
Cc: dri-devel@lists.freedesktop.org, ojeda@kernel.org, gary@garyguo.net
Subject: Re: [PATCH 3/7] rust: reset: add ExclusiveResetControl::get_array() and get_array_optional()
Date: Thu, 26 Nov 2026 16:11:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-235891@kernel.org> (raw)
In-Reply-To: <20261126-b4-rust-reset-v1-3-9c4c3d029080@collabora.com>

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 <daniel.almeida@collabora.com>

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/20261126-b4-rust-reset-v1-0-9c4c3d029080@collabora.com?part=3

  reply	other threads:[~2026-11-26 16:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 16:04 [PATCH 0/7] rust: reset: add reset control abstractions Daniel Almeida
2026-11-26 16:04 ` [PATCH 1/7] rust: reset: add reset control helpers Daniel Almeida
2026-11-26 16:04 ` [PATCH 2/7] rust: reset: add ExclusiveResetControl Daniel Almeida
2026-11-26 16:04 ` [PATCH 3/7] rust: reset: add ExclusiveResetControl::get_array() and get_array_optional() Daniel Almeida
2026-11-26 16:11   ` sashiko-bot [this message]
2026-11-26 16:04 ` [PATCH 4/7] rust: reset: add AssertedGuard Daniel Almeida
2026-11-26 16:04 ` [PATCH 5/7] rust: reset: add SharedResetControl Daniel Almeida
2026-11-26 19:14   ` Alice Ryhl
2026-11-26 16:04 ` [PATCH 6/7] rust: reset: add SharedResetControl::get_array() and get_array_optional() Daniel Almeida
2026-11-26 16:04 ` [PATCH 7/7] rust: reset: add devm_deassert() and devm_deassert_optional() Daniel Almeida
2026-11-26 16:33 ` [PATCH 0/7] rust: reset: add reset control abstractions Nicolas Dufresne
2026-11-26 18:02   ` Daniel Almeida
2026-11-26 18:11     ` Nicolas Dufresne
2026-11-26 18:36       ` Daniel Almeida
2026-11-26 18:46         ` Nicolas Dufresne
2026-11-27 10:30 ` Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-235891@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox