On Fri Jan 16, 2026 at 10:49 PM CET, Timur Tabi wrote:
> Replace the module_pci_driver! macro with an explicit module
> initialization using the standard module! macro and InPlaceModule
> trait implementation.  No functional change intended, with the
> exception that the driver now prints a message when loaded.
>
> This change is necessary so that we can create a top-level "nova_core"
> debugfs entry when the driver is loaded.
>
> Signed-off-by: Timur Tabi <[email protected]>
> ---
>  drivers/gpu/nova-core/nova_core.rs | 26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/nova_core.rs 
> b/drivers/gpu/nova-core/nova_core.rs
> index c1121e7c64c5..d0df8db3693d 100644
> --- a/drivers/gpu/nova-core/nova_core.rs
> +++ b/drivers/gpu/nova-core/nova_core.rs
> @@ -2,6 +2,13 @@
>  
>  //! Nova Core GPU Driver
>  
> +use kernel::{
> +    error::Error,

This should be covered by prelude.

> +    pci,
> +    prelude::*,
> +    InPlaceModule, //
> +};
> +
>  #[macro_use]
>  mod bitfield;
>  
> @@ -20,13 +27,26 @@
>  
>  pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as 
> kernel::ModuleMetadata>::NAME;
>  
> -kernel::module_pci_driver! {
> -    type: driver::NovaCore,
> +#[pin_data]
> +struct NovaCoreModule {
> +    #[pin]
> +    _driver: kernel::driver::Registration<pci::Adapter<driver::NovaCore>>,

Let's import driver, such that this becomes driver::Registration<_>.

> +}
> +
> +impl InPlaceModule for NovaCoreModule {
> +    fn init(module: &'static kernel::ThisModule) -> impl PinInit<Self, 
> Error> {
> +        try_pin_init!(Self {
> +            _driver <- kernel::driver::Registration::new(MODULE_NAME, 
> module),

Same here.

> +        })
> +    }
> +}
> +
> +module! {
> +    type: NovaCoreModule,
>      name: "NovaCore",
>      authors: ["Danilo Krummrich"],
>      description: "Nova Core GPU driver",
>      license: "GPL v2",
> -    firmware: [],

Should be a separate patch.

Reply via email to