rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	dri-devel@lists.freedesktop.org, dakr@kernel.org,
	Alistair Popple <apopple@nvidia.com>,
	Miguel Ojeda <ojeda@kernel.org>,
	Alex Gaynor <alex.gaynor@gmail.com>,
	Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>,
	bjorn3_gh@protonmail.com, Benno Lossin <lossin@kernel.org>,
	Andreas Hindborg <a.hindborg@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>,
	Trevor Gross <tmgross@umich.edu>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	John Hubbard <jhubbard@nvidia.com>, Timur Tabi <ttabi@nvidia.com>,
	joel@joelfernandes.org, Elle Rhumsaa <elle@weathered-steel.dev>,
	Yury Norov <yury.norov@gmail.com>,
	Daniel Almeida <daniel.almeida@collabora.com>,
	Andrea Righi <arighi@nvidia.com>,
	nouveau@lists.freedesktop.org
Subject: Re: [PATCH] nova-core: vbios: Rework BiosImage composition to use AsRef and traits
Date: Mon, 6 Oct 2025 08:23:30 -0400	[thread overview]
Message-ID: <20251006122330.GA2205242@joelbox2> (raw)
In-Reply-To: <DDB0EGNAS7N8.X5GFDGYLHUPX@nvidia.com>

On Mon, Oct 06, 2025 at 03:01:42PM +0900, Alexandre Courbot wrote:
> Hi Joel,
> 
> On Mon Oct 6, 2025 at 7:08 AM JST, Joel Fernandes wrote:
> <snip>
> > +/// Trait for all BIOS image types
> > +#[expect(dead_code)]
> > +trait BiosImageTrait: AsRef<BiosImage> {
> 
> I see that this trait is implemented 4 times, but it has no user.
> Actually I can remove the trait definition, its implementations, and the
> `AsRef` implementations added by this patch, and the code builds just
> fine - only with 50 less lines of code. Is this needed at all?
> 

Indeed! So in the previous edition of this code, the pattern was: iterate
over specific image types and then call the common methods, from the main
loop. Now the pattern is iterate over the common type and firectly call the
common methods.

So I inadvertently simplified the usecase thus removing the need for the
"function routing" in the first place!

That is good news, so I will just submit a new patch reworking this without
the new traits and AsRef.

That will result in 50 lines lesser as you mentioned! So please discard
this patch, thanks! Should we need routing to common methods, we can always
add that in the future.

(Just to note, we can discard another 20 or so lines once we have the support
to generate the enum TryFrokm boilerplate).

      reply	other threads:[~2025-10-06 12:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-05 22:08 [PATCH] nova-core: vbios: Rework BiosImage composition to use AsRef and traits Joel Fernandes
2025-10-06  6:01 ` Alexandre Courbot
2025-10-06 12:23   ` Joel Fernandes [this message]

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=20251006122330.GA2205242@joelbox2 \
    --to=joelagnelf@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=arighi@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=elle@weathered-steel.dev \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --cc=tzimmermann@suse.de \
    --cc=yury.norov@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).