> On Dec 13, 2025, at 6:00 AM, Timur Tabi <[email protected]> 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.
> 
> Also add a no-op module exit function as a template.
> 
> This change is necessary so that we can create a top-level "novacore"
> debugfs entry when the driver is loaded.
> 
> Signed-off-by: Timur Tabi <[email protected]>
> ---
> drivers/gpu/nova-core/nova_core.rs | 29 ++++++++++++++++++++++++++---
> 1 file changed, 26 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/nova_core.rs 
> b/drivers/gpu/nova-core/nova_core.rs
> index b98a1c03f13d..7d7b75650b04 100644
> --- a/drivers/gpu/nova-core/nova_core.rs
> +++ b/drivers/gpu/nova-core/nova_core.rs
> @@ -2,6 +2,9 @@
> 
> //! Nova Core GPU Driver
> 
> +use kernel::{error::Error, pci, prelude::*, InPlaceModule};
> +use pin_init::{PinInit, pinned_drop};
> +

Import style errors (one per line with final //) needs fixing in this and other 
patches.

 - Joel



> #[macro_use]
> mod bitfield;
> 
> @@ -21,13 +24,33 @@
> 
> pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as 
> kernel::ModuleMetadata>::NAME;
> 
> -kernel::module_pci_driver! {
> -    type: driver::NovaCore,
> +#[pin_data(PinnedDrop)]
> +struct NovaCoreModule {
> +    #[pin]
> +    _driver: kernel::driver::Registration<pci::Adapter<driver::NovaCore>>,
> +}
> +
> +impl InPlaceModule for NovaCoreModule {
> +    fn init(module: &'static kernel::ThisModule) -> impl PinInit<Self, 
> Error> {
> +        pr_info!("NovaCore GPU driver loaded\n");
> +        try_pin_init!(Self {
> +            _driver <- kernel::driver::Registration::new(MODULE_NAME, 
> module),
> +        })
> +    }
> +}
> +
> +#[pinned_drop]
> +impl PinnedDrop for NovaCoreModule {
> +    fn drop(self: Pin<&mut Self>) {
> +    }
> +}
> +
> +module! {
> +    type: NovaCoreModule,
>     name: "NovaCore",
>     authors: ["Danilo Krummrich"],
>     description: "Nova Core GPU driver",
>     license: "GPL v2",
> -    firmware: [],
> }
> 
> kernel::module_firmware!(firmware::ModInfoBuilder);
> --
> 2.52.0
> 

Reply via email to