All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lyude Paul" <lyude@redhat.com>
Cc: dri-devel@lists.freedesktop.org, ojeda@kernel.org
Subject: Re: [PATCH v20 3/4] rust: faux: Allow retrieving a bound Device
Date: Wed, 10 Jun 2026 16:37:41 +0000	[thread overview]
Message-ID: <20260610163742.248F21F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260610162433.923550-4-lyude@redhat.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The newly added invariant comment incorrectly states the faux device is 'bound to a device' instead of 'bound to a driver'.
- [Low] Missing `// INVARIANT:` comment justification for the newly added type invariant in the constructor `Registration::new()`.
--

commit 4f6cdb361b5df7689eb3f97b5d9628c28576af9e
Author: Lyude Paul <lyude@redhat.com>

rust: faux: Allow retrieving a bound Device

This commit allows retrieving a Bound device context from a faux::Registration
by implementing AsRef<device::Device<device::Bound>>. It also adds a new type
invariant stating that the Registration object proves the device is bound.

> diff --git a/rust/kernel/faux.rs b/rust/kernel/faux.rs
> index 43b4974f48cd2..20ab638885354 100644
> --- a/rust/kernel/faux.rs
> +++ b/rust/kernel/faux.rs
> @@ -25,7 +25,8 @@
>  ///
>  /// # Invariants
>  ///
> -/// `self.0` always holds a valid pointer to an initialized and registered [`struct faux_device`].
> +/// - `self.0` always holds a valid pointer to an initialized and registered [`struct faux_device`].
> +/// - This object is proof that the object described by this `Registration` is bound to a device.

[Severity: Low]
This isn't a bug, but should this say "bound to a driver" instead of "bound to
a device"? A faux device is bound to a driver, not another device.

[Severity: Low]
Since a new invariant was added here, does Registration::new() need an updated
// INVARIANT: comment to justify it?

According to the subsystem guidelines, when a struct with an # Invariants
section is constructed, there must be a corresponding // INVARIANT: comment.
The current constructor only justifies the first invariant:

rust/kernel/faux.rs:Registration::new() {
    ...
        // The above function will return either a valid device, or NULL on failure
        // INVARIANT: The device will remain registered until faux_device_destroy() is called, which
        // happens in our Drop implementation.
        Ok(Self(NonNull::new(dev).ok_or(ENODEV)?))
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260610162433.923550-1-lyude@redhat.com?part=3

  reply	other threads:[~2026-06-10 16:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 16:21 [PATCH v20 0/4] Rust bindings for gem shmem Lyude Paul
2026-06-10 16:21 ` Lyude Paul
2026-06-10 16:21 ` [PATCH v20 1/4] rust: drm: gem: shmem: Add DmaResvGuard helper Lyude Paul
2026-06-10 16:21   ` Lyude Paul
2026-06-10 16:21 ` [PATCH v20 2/4] rust: drm: gem: shmem: Add vmap functions Lyude Paul
2026-06-10 16:21   ` Lyude Paul
2026-06-10 16:39   ` sashiko-bot
2026-06-10 16:21 ` [PATCH v20 3/4] rust: faux: Allow retrieving a bound Device Lyude Paul
2026-06-10 16:21   ` Lyude Paul
2026-06-10 16:37   ` sashiko-bot [this message]
2026-06-10 16:21 ` [PATCH v20 4/4] rust: drm: gem: Introduce shmem::Object::sg_table() Lyude Paul
2026-06-10 16:21   ` Lyude Paul
2026-06-10 16:46   ` sashiko-bot

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=20260610163742.248F21F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.