[PATCH v2 1/2] gpu: nova-core: minor NovaCoreApi cleanup

From: Danilo Krummrich

Date: Wed Nov 11 2026 - 11:24:53 EST


Add a constructor for NovaCoreApi and use it when registering the
auxiliary device, allowing the gpu and pdev fields to become private.

While at it, rename the lifetime from 'bound to 'api to reflect the API
handle's scope; 'bound should only be used by a driver's bus device
private data.

Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
---
Changes in v2: new in this revision
---
drivers/gpu/nova-core/api.rs | 13 +++++++++----
drivers/gpu/nova-core/driver.rs | 2 +-
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/nova-core/api.rs b/drivers/gpu/nova-core/api.rs
index eec69aace3b2..dc877ddebe8c 100644
--- a/drivers/gpu/nova-core/api.rs
+++ b/drivers/gpu/nova-core/api.rs
@@ -22,12 +22,17 @@
};

/// API handle for the auxiliary bus child drivers to interact with nova-core.
-pub struct NovaCoreApi<'bound> {
- pub(crate) gpu: Pin<&'bound Gpu<'bound>>,
- pub(crate) pdev: &'bound pci::Device<Bound>,
+pub struct NovaCoreApi<'api> {
+ gpu: Pin<&'api Gpu<'api>>,
+ pdev: &'api pci::Device<Bound>,
}

-impl NovaCoreApi<'_> {
+impl<'api> NovaCoreApi<'api> {
+ /// Creates an API handle.
+ pub(crate) fn new(pdev: &'api pci::Device<Bound>, gpu: Pin<&'api Gpu<'api>>) -> Self {
+ Self { gpu, pdev }
+ }
+
/// Obtain a [`NovaCoreApi`] handle from an auxiliary device registered
/// by nova-core.
pub fn of(adev: &auxiliary::Device<Bound>) -> Result<NovaCoreApiHandle<'_>> {
diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
index 560a70c4f5a7..2376d960eb6b 100644
--- a/drivers/gpu/nova-core/driver.rs
+++ b/drivers/gpu/nova-core/driver.rs
@@ -164,7 +164,7 @@ fn probe<'bound>(
// never recycles IDs.
AUXILIARY_ID_COUNTER.fetch_add(1, Relaxed),
crate::MODULE_NAME,
- NovaCoreApi { gpu, pdev },
+ NovaCoreApi::new(pdev, gpu),
)?
}
},

base-commit: 6e557330b874b0e1fdd03e8fe4c438f36c93eefa
--
2.56.0