mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] gpu: nova-core: minor NovaCoreApi cleanup
@ 2026-11-11 16:19 Danilo Krummrich
  2026-11-11 16:19 ` [PATCH v2 2/2] gpu: nova-core: use pin-init self-referential support Danilo Krummrich
  2026-11-16  7:41 ` [PATCH v2 1/2] gpu: nova-core: minor NovaCoreApi cleanup Alexandre Courbot
  0 siblings, 2 replies; 8+ messages in thread
From: Danilo Krummrich @ 2026-11-11 16:19 UTC (permalink / raw)
  To: dakr, acourbot, aliceryhl, airlied, simona, lossin, gary
  Cc: nova-gpu, dri-devel, rust-for-linux, linux-kernel

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@kernel.org>
---
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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-16 13:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 16:19 [PATCH v2 1/2] gpu: nova-core: minor NovaCoreApi cleanup Danilo Krummrich
2026-11-11 16:19 ` [PATCH v2 2/2] gpu: nova-core: use pin-init self-referential support Danilo Krummrich
2026-11-16  7:56   ` Alexandre Courbot
2026-11-16 11:52     ` Gary Guo
2026-11-16 12:47       ` Danilo Krummrich
2026-11-16 12:51         ` Gary Guo
2026-11-16 13:59         ` Alexandre Courbot
2026-11-16  7:41 ` [PATCH v2 1/2] gpu: nova-core: minor NovaCoreApi cleanup Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®