public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpu: nova-core: replace `kernel::c_str!` with C-Strings
@ 2025-12-22 12:20 Tamir Duberstein
  2025-12-22 14:28 ` Daniel Almeida
  2025-12-22 16:58 ` Danilo Krummrich
  0 siblings, 2 replies; 3+ messages in thread
From: Tamir Duberstein @ 2025-12-22 12:20 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Alexandre Courbot, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross
  Cc: nouveau, dri-devel, linux-kernel, rust-for-linux,
	Tamir Duberstein, Greg Kroah-Hartman

From: Tamir Duberstein <tamird@gmail.com>

C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 drivers/gpu/drm/nova/driver.rs  | 12 +++++-------
 drivers/gpu/nova-core/driver.rs |  5 ++---
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/nova/driver.rs b/drivers/gpu/drm/nova/driver.rs
index 2246d8e104e0..d24ade17f7a0 100644
--- a/drivers/gpu/drm/nova/driver.rs
+++ b/drivers/gpu/drm/nova/driver.rs
@@ -1,8 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 
-use kernel::{
-    auxiliary, c_str, device::Core, drm, drm::gem, drm::ioctl, prelude::*, sync::aref::ARef,
-};
+use kernel::{auxiliary, device::Core, drm, drm::gem, drm::ioctl, prelude::*, sync::aref::ARef};
 
 use crate::file::File;
 use crate::gem::NovaObject;
@@ -24,12 +22,12 @@ pub(crate) struct NovaData {
     major: 0,
     minor: 0,
     patchlevel: 0,
-    name: c_str!("nova"),
-    desc: c_str!("Nvidia Graphics"),
+    name: c"nova",
+    desc: c"Nvidia Graphics",
 };
 
-const NOVA_CORE_MODULE_NAME: &CStr = c_str!("NovaCore");
-const AUXILIARY_NAME: &CStr = c_str!("nova-drm");
+const NOVA_CORE_MODULE_NAME: &CStr = c"NovaCore";
+const AUXILIARY_NAME: &CStr = c"nova-drm";
 
 kernel::auxiliary_device_table!(
     AUX_TABLE,
diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
index b8b0cc0f2d93..5a4cc047bcfc 100644
--- a/drivers/gpu/nova-core/driver.rs
+++ b/drivers/gpu/nova-core/driver.rs
@@ -2,7 +2,6 @@
 
 use kernel::{
     auxiliary,
-    c_str,
     device::Core,
     devres::Devres,
     dma::Device,
@@ -82,7 +81,7 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E
             unsafe { pdev.dma_set_mask_and_coherent(DmaMask::new::<GPU_DMA_BITS>())? };
 
             let bar = Arc::pin_init(
-                pdev.iomap_region_sized::<BAR0_SIZE>(0, c_str!("nova-core/bar0")),
+                pdev.iomap_region_sized::<BAR0_SIZE>(0, c"nova-core/bar0"),
                 GFP_KERNEL,
             )?;
 
@@ -90,7 +89,7 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E
                 gpu <- Gpu::new(pdev, bar.clone(), bar.access(pdev.as_ref())?),
                 _reg <- auxiliary::Registration::new(
                     pdev.as_ref(),
-                    c_str!("nova-drm"),
+                    c"nova-drm",
                     0, // TODO[XARR]: Once it lands, use XArray; for now we don't use the ID.
                     crate::MODULE_NAME
                 ),

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cstr-nova-c13a8ec1d068

Best regards,
--  
Tamir Duberstein <tamird@gmail.com>


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

* Re: [PATCH] gpu: nova-core: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:20 [PATCH] gpu: nova-core: replace `kernel::c_str!` with C-Strings Tamir Duberstein
@ 2025-12-22 14:28 ` Daniel Almeida
  2025-12-22 16:58 ` Danilo Krummrich
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Almeida @ 2025-12-22 14:28 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Alexandre Courbot, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, nouveau, dri-devel, linux-kernel, rust-for-linux,
	Tamir Duberstein, Greg Kroah-Hartman



> On 22 Dec 2025, at 09:20, Tamir Duberstein <tamird@kernel.org> wrote:
> 
> From: Tamir Duberstein <tamird@gmail.com>
> 
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
> 
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Reviewed-by: Benno Lossin <lossin@kernel.org>
> Acked-by: Danilo Krummrich <dakr@kernel.org>
> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> drivers/gpu/drm/nova/driver.rs  | 12 +++++-------
> drivers/gpu/nova-core/driver.rs |  5 ++---
> 2 files changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nova/driver.rs b/drivers/gpu/drm/nova/driver.rs
> index 2246d8e104e0..d24ade17f7a0 100644
> --- a/drivers/gpu/drm/nova/driver.rs
> +++ b/drivers/gpu/drm/nova/driver.rs
> @@ -1,8 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> 
> -use kernel::{
> -    auxiliary, c_str, device::Core, drm, drm::gem, drm::ioctl, prelude::*, sync::aref::ARef,
> -};
> +use kernel::{auxiliary, device::Core, drm, drm::gem, drm::ioctl, prelude::*, sync::aref::ARef};
> 
> use crate::file::File;
> use crate::gem::NovaObject;
> @@ -24,12 +22,12 @@ pub(crate) struct NovaData {
>     major: 0,
>     minor: 0,
>     patchlevel: 0,
> -    name: c_str!("nova"),
> -    desc: c_str!("Nvidia Graphics"),
> +    name: c"nova",
> +    desc: c"Nvidia Graphics",
> };
> 
> -const NOVA_CORE_MODULE_NAME: &CStr = c_str!("NovaCore");
> -const AUXILIARY_NAME: &CStr = c_str!("nova-drm");
> +const NOVA_CORE_MODULE_NAME: &CStr = c"NovaCore";
> +const AUXILIARY_NAME: &CStr = c"nova-drm";
> 
> kernel::auxiliary_device_table!(
>     AUX_TABLE,
> diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
> index b8b0cc0f2d93..5a4cc047bcfc 100644
> --- a/drivers/gpu/nova-core/driver.rs
> +++ b/drivers/gpu/nova-core/driver.rs
> @@ -2,7 +2,6 @@
> 
> use kernel::{
>     auxiliary,
> -    c_str,
>     device::Core,
>     devres::Devres,
>     dma::Device,
> @@ -82,7 +81,7 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E
>             unsafe { pdev.dma_set_mask_and_coherent(DmaMask::new::<GPU_DMA_BITS>())? };
> 
>             let bar = Arc::pin_init(
> -                pdev.iomap_region_sized::<BAR0_SIZE>(0, c_str!("nova-core/bar0")),
> +                pdev.iomap_region_sized::<BAR0_SIZE>(0, c"nova-core/bar0"),
>                 GFP_KERNEL,
>             )?;
> 
> @@ -90,7 +89,7 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E
>                 gpu <- Gpu::new(pdev, bar.clone(), bar.access(pdev.as_ref())?),
>                 _reg <- auxiliary::Registration::new(
>                     pdev.as_ref(),
> -                    c_str!("nova-drm"),
> +                    c"nova-drm",
>                     0, // TODO[XARR]: Once it lands, use XArray; for now we don't use the ID.
>                     crate::MODULE_NAME
>                 ),
> 
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-nova-c13a8ec1d068
> 
> Best regards,
> --  
> Tamir Duberstein <tamird@gmail.com>
> 
> 

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>

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

* Re: [PATCH] gpu: nova-core: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:20 [PATCH] gpu: nova-core: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2025-12-22 14:28 ` Daniel Almeida
@ 2025-12-22 16:58 ` Danilo Krummrich
  1 sibling, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2025-12-22 16:58 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Alice Ryhl, David Airlie, Simona Vetter, Alexandre Courbot,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, nouveau, dri-devel,
	linux-kernel, rust-for-linux, Tamir Duberstein,
	Greg Kroah-Hartman

On Mon Dec 22, 2025 at 1:20 PM CET, Tamir Duberstein wrote:
> From: Tamir Duberstein <tamird@gmail.com>
>
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Reviewed-by: Benno Lossin <lossin@kernel.org>
> Acked-by: Danilo Krummrich <dakr@kernel.org>
> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Applied to drm-rust-next, thanks!

    [ Use 'nova' commit subject prefix; use kernel vertical import style.
      - Danilo ]

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

end of thread, other threads:[~2025-12-22 16:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 12:20 [PATCH] gpu: nova-core: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2025-12-22 14:28 ` Daniel Almeida
2025-12-22 16:58 ` Danilo Krummrich

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