netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings
@ 2026-01-04  2:24 Tamir Duberstein
  2026-01-04  2:24 ` [PATCH v2 1/2] " Tamir Duberstein
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tamir Duberstein @ 2026-01-04  2:24 UTC (permalink / raw)
  To: FUJITA Tomonori, Trevor Gross, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Danilo Krummrich, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, rust-for-linux, linux-kernel, Tamir Duberstein,
	Greg Kroah-Hartman, Daniel Almeida

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

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
Changes in v2:
- Pick up Tomo and Daniel's tags.
- Link to v1: https://patch.msgid.link/20251222-cstr-net-v1-0-cd9e30a5467e@gmail.com

---
Tamir Duberstein (2):
      rust: net: replace `kernel::c_str!` with C-Strings
      drivers: net: replace `kernel::c_str!` with C-Strings

 drivers/net/phy/ax88796b_rust.rs | 7 +++----
 drivers/net/phy/qt2025.rs        | 5 ++---
 rust/kernel/net/phy.rs           | 6 ++----
 3 files changed, 7 insertions(+), 11 deletions(-)
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cstr-net-3bfd7b35acc1

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


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

* [PATCH v2 1/2] rust: net: replace `kernel::c_str!` with C-Strings
  2026-01-04  2:24 [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings Tamir Duberstein
@ 2026-01-04  2:24 ` Tamir Duberstein
  2026-01-04  2:24 ` [PATCH v2 2/2] drivers: " Tamir Duberstein
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tamir Duberstein @ 2026-01-04  2:24 UTC (permalink / raw)
  To: FUJITA Tomonori, Trevor Gross, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Danilo Krummrich, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, rust-for-linux, linux-kernel, Tamir Duberstein,
	Greg Kroah-Hartman, Daniel Almeida

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>
Reviewed-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 rust/kernel/net/phy.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index bf6272d87a7b..3ca99db5cccf 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -777,7 +777,6 @@ const fn as_int(&self) -> u32 {
 ///
 /// ```
 /// # mod module_phy_driver_sample {
-/// use kernel::c_str;
 /// use kernel::net::phy::{self, DeviceId};
 /// use kernel::prelude::*;
 ///
@@ -796,7 +795,7 @@ const fn as_int(&self) -> u32 {
 ///
 /// #[vtable]
 /// impl phy::Driver for PhySample {
-///     const NAME: &'static CStr = c_str!("PhySample");
+///     const NAME: &'static CStr = c"PhySample";
 ///     const PHY_DEVICE_ID: phy::DeviceId = phy::DeviceId::new_with_exact_mask(0x00000001);
 /// }
 /// # }
@@ -805,7 +804,6 @@ const fn as_int(&self) -> u32 {
 /// This expands to the following code:
 ///
 /// ```ignore
-/// use kernel::c_str;
 /// use kernel::net::phy::{self, DeviceId};
 /// use kernel::prelude::*;
 ///
@@ -825,7 +823,7 @@ const fn as_int(&self) -> u32 {
 ///
 /// #[vtable]
 /// impl phy::Driver for PhySample {
-///     const NAME: &'static CStr = c_str!("PhySample");
+///     const NAME: &'static CStr = c"PhySample";
 ///     const PHY_DEVICE_ID: phy::DeviceId = phy::DeviceId::new_with_exact_mask(0x00000001);
 /// }
 ///

-- 
2.52.0


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

* [PATCH v2 2/2] drivers: net: replace `kernel::c_str!` with C-Strings
  2026-01-04  2:24 [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2026-01-04  2:24 ` [PATCH v2 1/2] " Tamir Duberstein
@ 2026-01-04  2:24 ` Tamir Duberstein
  2026-01-05 16:20 ` [PATCH v2 0/2] rust: " Tamir Duberstein
  2026-01-06  0:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Tamir Duberstein @ 2026-01-04  2:24 UTC (permalink / raw)
  To: FUJITA Tomonori, Trevor Gross, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Danilo Krummrich, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, rust-for-linux, linux-kernel, Tamir Duberstein,
	Greg Kroah-Hartman, Daniel Almeida

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>
Reviewed-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 drivers/net/phy/ax88796b_rust.rs | 7 +++----
 drivers/net/phy/qt2025.rs        | 5 ++---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/ax88796b_rust.rs b/drivers/net/phy/ax88796b_rust.rs
index bc73ebccc2aa..2d24628a4e58 100644
--- a/drivers/net/phy/ax88796b_rust.rs
+++ b/drivers/net/phy/ax88796b_rust.rs
@@ -5,7 +5,6 @@
 //!
 //! C version of this driver: [`drivers/net/phy/ax88796b.c`](./ax88796b.c)
 use kernel::{
-    c_str,
     net::phy::{self, reg::C22, DeviceId, Driver},
     prelude::*,
     uapi,
@@ -41,7 +40,7 @@ fn asix_soft_reset(dev: &mut phy::Device) -> Result {
 #[vtable]
 impl Driver for PhyAX88772A {
     const FLAGS: u32 = phy::flags::IS_INTERNAL;
-    const NAME: &'static CStr = c_str!("Asix Electronics AX88772A");
+    const NAME: &'static CStr = c"Asix Electronics AX88772A";
     const PHY_DEVICE_ID: DeviceId = DeviceId::new_with_exact_mask(0x003b1861);
 
     // AX88772A is not working properly with some old switches (NETGEAR EN 108TP):
@@ -105,7 +104,7 @@ fn link_change_notify(dev: &mut phy::Device) {
 #[vtable]
 impl Driver for PhyAX88772C {
     const FLAGS: u32 = phy::flags::IS_INTERNAL;
-    const NAME: &'static CStr = c_str!("Asix Electronics AX88772C");
+    const NAME: &'static CStr = c"Asix Electronics AX88772C";
     const PHY_DEVICE_ID: DeviceId = DeviceId::new_with_exact_mask(0x003b1881);
 
     fn suspend(dev: &mut phy::Device) -> Result {
@@ -125,7 +124,7 @@ fn soft_reset(dev: &mut phy::Device) -> Result {
 
 #[vtable]
 impl Driver for PhyAX88796B {
-    const NAME: &'static CStr = c_str!("Asix Electronics AX88796B");
+    const NAME: &'static CStr = c"Asix Electronics AX88796B";
     const PHY_DEVICE_ID: DeviceId = DeviceId::new_with_model_mask(0x003b1841);
 
     fn soft_reset(dev: &mut phy::Device) -> Result {
diff --git a/drivers/net/phy/qt2025.rs b/drivers/net/phy/qt2025.rs
index aaaead6512a0..470d89a0ac00 100644
--- a/drivers/net/phy/qt2025.rs
+++ b/drivers/net/phy/qt2025.rs
@@ -9,7 +9,6 @@
 //!
 //! The QT2025 PHY integrates an Intel 8051 micro-controller.
 
-use kernel::c_str;
 use kernel::error::code;
 use kernel::firmware::Firmware;
 use kernel::io::poll::read_poll_timeout;
@@ -38,7 +37,7 @@
 
 #[vtable]
 impl Driver for PhyQT2025 {
-    const NAME: &'static CStr = c_str!("QT2025 10Gpbs SFP+");
+    const NAME: &'static CStr = c"QT2025 10Gpbs SFP+";
     const PHY_DEVICE_ID: phy::DeviceId = phy::DeviceId::new_with_exact_mask(0x0043a400);
 
     fn probe(dev: &mut phy::Device) -> Result<()> {
@@ -71,7 +70,7 @@ fn probe(dev: &mut phy::Device) -> Result<()> {
         // The micro-controller will start running from the boot ROM.
         dev.write(C45::new(Mmd::PCS, 0xe854), 0x00c0)?;
 
-        let fw = Firmware::request(c_str!("qt2025-2.0.3.3.fw"), dev.as_ref())?;
+        let fw = Firmware::request(c"qt2025-2.0.3.3.fw", dev.as_ref())?;
         if fw.data().len() > SZ_16K + SZ_8K {
             return Err(code::EFBIG);
         }

-- 
2.52.0


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

* Re: [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings
  2026-01-04  2:24 [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2026-01-04  2:24 ` [PATCH v2 1/2] " Tamir Duberstein
  2026-01-04  2:24 ` [PATCH v2 2/2] drivers: " Tamir Duberstein
@ 2026-01-05 16:20 ` Tamir Duberstein
  2026-01-06  0:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Tamir Duberstein @ 2026-01-05 16:20 UTC (permalink / raw)
  To: FUJITA Tomonori, Trevor Gross, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Danilo Krummrich, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, rust-for-linux, linux-kernel, Greg Kroah-Hartman,
	Daniel Almeida

On Sat, Jan 3, 2026 at 9:24 PM Tamir Duberstein <tamird@kernel.org> wrote:
>
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

@Jakub are you able to take this through net-next?

> ---
> Changes in v2:
> - Pick up Tomo and Daniel's tags.
> - Link to v1: https://patch.msgid.link/20251222-cstr-net-v1-0-cd9e30a5467e@gmail.com
>
> ---
> Tamir Duberstein (2):
>       rust: net: replace `kernel::c_str!` with C-Strings
>       drivers: net: replace `kernel::c_str!` with C-Strings
>
>  drivers/net/phy/ax88796b_rust.rs | 7 +++----
>  drivers/net/phy/qt2025.rs        | 5 ++---
>  rust/kernel/net/phy.rs           | 6 ++----
>  3 files changed, 7 insertions(+), 11 deletions(-)
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-net-3bfd7b35acc1
>
> Best regards,
> --
> Tamir Duberstein <tamird@gmail.com>
>

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

* Re: [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings
  2026-01-04  2:24 [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings Tamir Duberstein
                   ` (2 preceding siblings ...)
  2026-01-05 16:20 ` [PATCH v2 0/2] rust: " Tamir Duberstein
@ 2026-01-06  0:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-06  0:50 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: fujita.tomonori, tmgross, ojeda, boqun.feng, gary, bjorn3_gh,
	lossin, a.hindborg, aliceryhl, dakr, andrew, hkallweit1, linux,
	davem, edumazet, kuba, pabeni, netdev, rust-for-linux,
	linux-kernel, tamird, gregkh, daniel.almeida

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 03 Jan 2026 21:24:26 -0500 you wrote:
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
> 
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> Changes in v2:
> - Pick up Tomo and Daniel's tags.
> - Link to v1: https://patch.msgid.link/20251222-cstr-net-v1-0-cd9e30a5467e@gmail.com
> 
> [...]

Here is the summary with links:
  - [v2,1/2] rust: net: replace `kernel::c_str!` with C-Strings
    https://git.kernel.org/netdev/net-next/c/7a8461a2a8da
  - [v2,2/2] drivers: net: replace `kernel::c_str!` with C-Strings
    https://git.kernel.org/netdev/net-next/c/5a69d30f30fd

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-01-06  0:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-04  2:24 [PATCH v2 0/2] rust: net: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2026-01-04  2:24 ` [PATCH v2 1/2] " Tamir Duberstein
2026-01-04  2:24 ` [PATCH v2 2/2] drivers: " Tamir Duberstein
2026-01-05 16:20 ` [PATCH v2 0/2] rust: " Tamir Duberstein
2026-01-06  0:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).