Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpu: nova-core: Replace module_pci_driver! with explicit module init

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 <ttabi@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: John Hubbard <jhubbard@nvidia.com>
Tested-by: Eliot Courtney <ecourtney@nvidia.com>
Link: https://patch.msgid.link/20260319212658.2541610-5-ttabi@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Timur Tabi and committed by
Danilo Krummrich
ea0c8380 01681851

+23 -2
+23 -2
drivers/gpu/nova-core/nova_core.rs
··· 2 2 3 3 //! Nova Core GPU Driver 4 4 5 + use kernel::{ 6 + driver::Registration, 7 + pci, 8 + prelude::*, 9 + InPlaceModule, // 10 + }; 11 + 5 12 #[macro_use] 6 13 mod bitfield; 7 14 ··· 27 20 28 21 pub(crate) const MODULE_NAME: &core::ffi::CStr = <LocalModule as kernel::ModuleMetadata>::NAME; 29 22 30 - kernel::module_pci_driver! { 31 - type: driver::NovaCore, 23 + #[pin_data] 24 + struct NovaCoreModule { 25 + #[pin] 26 + _driver: Registration<pci::Adapter<driver::NovaCore>>, 27 + } 28 + 29 + impl InPlaceModule for NovaCoreModule { 30 + fn init(module: &'static kernel::ThisModule) -> impl PinInit<Self, Error> { 31 + try_pin_init!(Self { 32 + _driver <- Registration::new(MODULE_NAME, module), 33 + }) 34 + } 35 + } 36 + 37 + module! { 38 + type: NovaCoreModule, 32 39 name: "NovaCore", 33 40 authors: ["Danilo Krummrich"], 34 41 description: "Nova Core GPU driver",