[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f4c3d869a1a47c31fe0c1b387511a33836a9647.camel@redhat.com>
Date: Thu, 11 Dec 2025 17:09:16 -0500
From: lyude@...hat.com
To: Alexandre Courbot <acourbot@...dia.com>, Danilo Krummrich
<dakr@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, David Airlie
<airlied@...il.com>, Simona Vetter <simona@...ll.ch>
Cc: John Hubbard <jhubbard@...dia.com>, Alistair Popple
<apopple@...dia.com>, Joel Fernandes <joelagnelf@...dia.com>, Timur Tabi
<ttabi@...dia.com>, Edwin Peer <epeer@...dia.com>,
nouveau@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 8/9] gpu: nova-core: use core library's CStr instead of
kernel one
Reviewed-by: Lyude Paul <lyude@...hat.com>
On Mon, 2025-12-08 at 18:27 +0900, Alexandre Courbot wrote:
> 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.
>
> Signed-off-by: Alexandre Courbot <acourbot@...dia.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()
Powered by blists - more mailing lists