From: Danilo Krummrich <dakr@kernel.org>
To: dakr@kernel.org, acourbot@nvidia.com, aliceryhl@google.com,
airlied@gmail.com, simona@ffwll.ch, lossin@kernel.org,
gary@garyguo.net
Cc: nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] gpu: nova-core: minor NovaCoreApi cleanup
Date: Wed, 11 Nov 2026 17:19:02 +0100 [thread overview]
Message-ID: <20261111161935.750047-1-dakr@kernel.org> (raw)
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
next reply other threads:[~2026-11-11 16:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 16:19 Danilo Krummrich [this message]
2026-11-11 16:19 ` [PATCH v2 2/2] gpu: nova-core: use pin-init self-referential support Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261111161935.750047-1-dakr@kernel.org \
--to=dakr@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®