Linux Media Controller development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lyude Paul" <lyude@redhat.com>
Cc: ojeda@kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v17 1/6] rust: drm: gem: shmem: Fix Default implementation for ObjectConfig
Date: Wed, 03 Jun 2026 20:02:16 +0000	[thread overview]
Message-ID: <20260603200216.A2F001F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603195210.693856-2-lyude@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect use of `#[inline(always)]` annotation for `ObjectConfig::default()`.
--

commit 974110b1b618554fdff7106e2b5a8152da0f6df4
Author: Lyude Paul <lyude@redhat.com>

rust: drm: gem: shmem: Fix Default implementation for ObjectConfig

This commit replaces the derived Default implementation for ObjectConfig
with a manual one. This avoids the requirement for the generic type T
to also implement Default, since T is only used as a reference type here.

> diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs
> index 34af402899a0e..084b798ce795b 100644
> --- a/rust/kernel/drm/gem/shmem.rs
> +++ b/rust/kernel/drm/gem/shmem.rs
[ ... ]
> @@ -53,6 +52,16 @@ pub struct ObjectConfig<'a, T: DriverObject, C: DeviceContext = Registered> {
>      pub parent_resv_obj: Option<&'a Object<T, C>>,
>  }
>  
> +impl<'a, T: DriverObject, C: DeviceContext> Default for ObjectConfig<'a, T, C> {
> +    #[inline(always)]
> +    fn default() -> Self {

[Severity: Low]
This isn't a bug, but should this be annotated with #[inline] instead of
#[inline(always)]?

According to the Rust subsystem guidelines, #[inline(always)] is reserved for
functions using build_assert!() that depend on function parameters, while
#[inline] is meant for small abstraction functions like ObjectConfig::default().

> +        Self {
> +            map_wc: false,
> +            parent_resv_obj: None,
> +        }
> +    }
> +}
> +
>  /// A shmem-backed GEM object.
>  ///
>  /// # Invariants

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

  reply	other threads:[~2026-06-03 20:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 19:42 [PATCH v17 0/6] Rust bindings for gem shmem Lyude Paul
2026-06-03 19:42 ` [PATCH v17 1/6] rust: drm: gem: shmem: Fix Default implementation for ObjectConfig Lyude Paul
2026-06-03 20:02   ` sashiko-bot [this message]
2026-06-04 11:49   ` Alice Ryhl
2026-06-03 19:42 ` [PATCH v17 2/6] rust: drm: gem: shmem: Add DmaResvGuard helper Lyude Paul
2026-06-03 20:09   ` sashiko-bot
2026-06-03 19:42 ` [PATCH v17 3/6] rust: drm: gem: shmem: Add vmap functions Lyude Paul
2026-06-03 20:11   ` sashiko-bot
2026-06-03 19:42 ` [PATCH v17 4/6] rust: faux: Allow retrieving a bound Device Lyude Paul
2026-06-03 20:08   ` sashiko-bot
2026-06-04 13:25   ` Danilo Krummrich
2026-06-04 18:48     ` lyude
2026-06-03 19:42 ` [PATCH v17 5/6] rust: sync: Add SetOnce::reset() Lyude Paul
2026-06-03 20:07   ` sashiko-bot
2026-06-04 11:58   ` Alice Ryhl
2026-06-04 18:53     ` lyude
2026-06-03 19:42 ` [PATCH v17 6/6] rust: drm: gem: Introduce shmem::Object::sg_table() Lyude Paul
2026-06-03 20:12   ` 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=20260603200216.A2F001F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-media@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox