Re: [PATCH v7 07/31] gpu: nova-core: move firmware image parsing code to firmware.rs

From: Miguel Ojeda

Date: Wed Mar 25 2026 - 07:23:49 EST


On Wed, Mar 25, 2026 at 4:30 AM John Hubbard <jhubbard@xxxxxxxxxx> wrote:
>
> The `mod elf` block is a nested module that doesn't have `use
> kernel::prelude::*;` in scope, so `size_of` isn't available without the
> explicit import.
>
> Or some it seems. I'm not experienced with the module scoping game,
> and so I may have it wrong.

Yeah, our "prelude" so far is a normal crate in Rust.

With the "custom prelude" feature that I have been asking upstream
Rust for a long time, that need would go away, i.e. we would be able
to define something like the standard library prelude -- I have a bit
more context in the wish list:

https://github.com/Rust-for-Linux/linux/issues/354

For doctests, I add it "manually" (but only at the top-level, i.e.
same issue, but at least we save most of those `use`s).

Having said that, instead of importing things from the prelude
manually, even in a submodule, if you need something from it, please
just import the prelude again, like we do at the top-level.

Thanks!

Cheers,
Miguel