public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Courbot <acourbot@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
	 Alistair Popple <apopple@nvidia.com>,
	 Joel Fernandes <joelagnelf@nvidia.com>,
	Timur Tabi <ttabi@nvidia.com>,  Edwin Peer <epeer@nvidia.com>,
	Eliot Courtney <ecourtney@nvidia.com>,
	 nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	 linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	 Alexandre Courbot <acourbot@nvidia.com>,
	Lyude Paul <lyude@redhat.com>
Subject: [PATCH v2 08/10] gpu: nova-core: use core library's CStr instead of kernel one
Date: Tue, 16 Dec 2025 13:27:28 +0900	[thread overview]
Message-ID: <20251216-nova-misc-v2-8-dc7b42586c04@nvidia.com> (raw)
In-Reply-To: <20251216-nova-misc-v2-0-dc7b42586c04@nvidia.com>

The kernel's own CStr type has been replaced by the one in the core
library, and is now an alias to the latter. Change our imports to
directly reference the actual type.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/firmware.rs     | 2 +-
 drivers/gpu/nova-core/firmware/gsp.rs | 6 ++++--
 drivers/gpu/nova-core/nova_core.rs    | 2 +-
 drivers/gpu/nova-core/util.rs         | 4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs
index 2d2008b33fb4..672f6cd24d4b 100644
--- a/drivers/gpu/nova-core/firmware.rs
+++ b/drivers/gpu/nova-core/firmware.rs
@@ -229,7 +229,7 @@ const fn make_entry_chipset(self, chipset: &str) -> Self {
     }
 
     pub(crate) const fn create(
-        module_name: &'static kernel::str::CStr,
+        module_name: &'static core::ffi::CStr,
     ) -> firmware::ModInfoBuilder<N> {
         let mut this = Self(firmware::ModInfoBuilder::new(module_name));
         let mut i = 0;
diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs
index 0549805282ab..53fdbf1de27e 100644
--- a/drivers/gpu/nova-core/firmware/gsp.rs
+++ b/drivers/gpu/nova-core/firmware/gsp.rs
@@ -34,10 +34,12 @@
 /// that scheme before nova-core becomes stable, which means this module will eventually be
 /// removed.
 mod elf {
-    use core::mem::size_of;
+    use core::{
+        ffi::CStr,
+        mem::size_of, //
+    };
 
     use kernel::bindings;
-    use kernel::str::CStr;
     use kernel::transmute::FromBytes;
 
     /// Newtype to provide a [`FromBytes`] implementation.
diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova-core/nova_core.rs
index b98a1c03f13d..3c26cf0b7c6e 100644
--- a/drivers/gpu/nova-core/nova_core.rs
+++ b/drivers/gpu/nova-core/nova_core.rs
@@ -19,7 +19,7 @@
 mod util;
 mod vbios;
 
-pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
+pub(crate) const MODULE_NAME: &core::ffi::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
 
 kernel::module_pci_driver! {
     type: driver::NovaCore,
diff --git a/drivers/gpu/nova-core/util.rs b/drivers/gpu/nova-core/util.rs
index 4b503249a3ef..8b2a4b99c55b 100644
--- a/drivers/gpu/nova-core/util.rs
+++ b/drivers/gpu/nova-core/util.rs
@@ -3,10 +3,10 @@
 /// Converts a null-terminated byte slice to a string, or `None` if the array does not
 /// contains any null byte or contains invalid characters.
 ///
-/// Contrary to [`kernel::str::CStr::from_bytes_with_nul`], the null byte can be anywhere in the
+/// Contrary to [`core::ffi::CStr::from_bytes_with_nul`], the null byte can be anywhere in the
 /// slice, and not only in the last position.
 pub(crate) fn str_from_null_terminated(bytes: &[u8]) -> Option<&str> {
-    use kernel::str::CStr;
+    use core::ffi::CStr;
 
     bytes
         .iter()

-- 
2.52.0


  parent reply	other threads:[~2025-12-16  4:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16  4:27 [PATCH v2 00/10] gpu: nova-core: miscellaneous improvements Alexandre Courbot
2025-12-16  4:27 ` [PATCH v2 01/10] gpu: nova-core: gsp: warn if data remains after processing a message Alexandre Courbot
2026-01-19 15:33   ` Gary Guo
2025-12-16  4:27 ` [PATCH v2 02/10] gpu: nova-core: gsp: remove unnecessary Display impls Alexandre Courbot
2026-01-19 15:41   ` Gary Guo
2025-12-16  4:27 ` [PATCH v2 03/10] gpu: nova-core: gsp: simplify sequencer opcode parsing Alexandre Courbot
2026-01-19 16:11   ` Gary Guo
2025-12-16  4:27 ` [PATCH v2 04/10] gpu: nova-core: gsp: remove unneeded sequencer trait Alexandre Courbot
2026-01-19 16:12   ` Gary Guo
2025-12-16  4:27 ` [PATCH v2 05/10] gpu: nova-core: gsp: derive `Debug` on more sequencer types Alexandre Courbot
2026-01-19 16:12   ` Gary Guo
2025-12-16  4:27 ` [PATCH v2 06/10] gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo Alexandre Courbot
2026-01-19 16:16   ` Gary Guo
2025-12-16  4:27 ` [PATCH v2 07/10] gpu: nova-core: firmware: fwsec: do not require bound device when unneeded Alexandre Courbot
2026-01-19 15:50   ` Danilo Krummrich
2025-12-16  4:27 ` Alexandre Courbot [this message]
2026-01-19 16:17   ` [PATCH v2 08/10] gpu: nova-core: use core library's CStr instead of kernel one Gary Guo
2025-12-16  4:27 ` [PATCH v2 09/10] gpu: nova-core: simplify str_from_null_terminated Alexandre Courbot
2026-01-03  3:37   ` John Hubbard
2026-01-03 10:14     ` Danilo Krummrich
2026-01-14 13:43       ` Alexandre Courbot
2025-12-16  4:27 ` [PATCH v2 10/10] gpu: nova-core: gsp: use available device reference Alexandre Courbot
2026-01-19 16:18   ` Gary Guo

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=20251216-nova-misc-v2-8-dc7b42586c04@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=epeer@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=ttabi@nvidia.com \
    /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