[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251006122330.GA2205242@joelbox2>
Date: Mon, 6 Oct 2025 08:23:30 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
dri-devel@...ts.freedesktop.org, dakr@...nel.org,
Alistair Popple <apopple@...dia.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
bjorn3_gh@...tonmail.com, Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
John Hubbard <jhubbard@...dia.com>, Timur Tabi <ttabi@...dia.com>,
joel@...lfernandes.org, Elle Rhumsaa <elle@...thered-steel.dev>,
Yury Norov <yury.norov@...il.com>,
Daniel Almeida <daniel.almeida@...labora.com>,
Andrea Righi <arighi@...dia.com>, nouveau@...ts.freedesktop.org
Subject: Re: [PATCH] nova-core: vbios: Rework BiosImage composition to use
AsRef and traits
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).
Powered by blists - more mailing lists