]> git.ipfire.org Git - thirdparty/linux.git/commit
gpu: nova-core: vbios: Rework BiosImage to be simpler
authorJoel Fernandes <joelagnelf@nvidia.com>
Thu, 9 Oct 2025 00:47:32 +0000 (20:47 -0400)
committerAlexandre Courbot <acourbot@nvidia.com>
Wed, 15 Oct 2025 23:04:46 +0000 (08:04 +0900)
commit1d5cffebd930d61588c32198f85fbe541ab97b8f
tree95cac78222204c50860ec59148631696b545dc89
parentf7a33a67c50c92589b046e69b9075b7d28d31f87
gpu: nova-core: vbios: Rework BiosImage to be simpler

Currently, the BiosImage type in vbios code is implemented as a
type-wrapping enum with the sole purpose of implementing a type that is
common to all specific image types. To make this work, macros were used
to overcome limitations of using enums. Ugly match statements were also
required to route methods from the enum type to the specific image type.

Simplify the code by just creating the common BiosImage type in the
iterator, and then converting it to specific image type after. This
works well since all the methods common to different BiosImage are
called only during the iteration and not later. Should we need to call
these common methods later, we can use AsRef and traits, but for now not
doing so gives us a nice ~50 negative line delta versus the existing
code and is a lot simpler.

Also remove the now obsolete BiosImage enum type.

Cc: Benno Lossin <lossin@kernel.org>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Message-ID: <20251009004732.2287050-1-joelagnelf@nvidia.com>
drivers/gpu/nova-core/vbios.rs