public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings
@ 2025-12-22 12:14 Tamir Duberstein
  2025-12-22 12:14 ` [PATCH 1/2] " Tamir Duberstein
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Tamir Duberstein @ 2025-12-22 12:14 UTC (permalink / raw)
  To: Igor Korotin, Danilo Krummrich, Daniel Almeida, Miguel Ojeda,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

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>
---
Tamir Duberstein (2):
      rust: i2c: replace `kernel::c_str!` with C-Strings
      samples: rust: i2c: replace `kernel::c_str!` with C-Strings

 rust/kernel/i2c.rs              | 8 ++++----
 samples/rust/rust_driver_i2c.rs | 7 +++----
 samples/rust/rust_i2c_client.rs | 7 +++----
 3 files changed, 10 insertions(+), 12 deletions(-)
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cstr-i2c-fce258eb7e5d

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


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

* [PATCH 1/2] rust: i2c: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:14 [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings Tamir Duberstein
@ 2025-12-22 12:14 ` Tamir Duberstein
  2025-12-22 12:14 ` [PATCH 2/2] samples: " Tamir Duberstein
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Tamir Duberstein @ 2025-12-22 12:14 UTC (permalink / raw)
  To: Igor Korotin, Danilo Krummrich, Daniel Almeida, Miguel Ojeda,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

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.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 rust/kernel/i2c.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs
index 491e6cc25cf4..792a71b15463 100644
--- a/rust/kernel/i2c.rs
+++ b/rust/kernel/i2c.rs
@@ -253,7 +253,7 @@ macro_rules! module_i2c_driver {
 /// # Example
 ///
 ///```
-/// # use kernel::{acpi, bindings, c_str, device::Core, i2c, of};
+/// # use kernel::{acpi, bindings, device::Core, i2c, of};
 ///
 /// struct MyDriver;
 ///
@@ -262,7 +262,7 @@ macro_rules! module_i2c_driver {
 ///     MODULE_ACPI_TABLE,
 ///     <MyDriver as i2c::Driver>::IdInfo,
 ///     [
-///         (acpi::DeviceId::new(c_str!("LNUXBEEF")), ())
+///         (acpi::DeviceId::new(c"LNUXBEEF"), ())
 ///     ]
 /// );
 ///
@@ -271,7 +271,7 @@ macro_rules! module_i2c_driver {
 ///     MODULE_I2C_TABLE,
 ///     <MyDriver as i2c::Driver>::IdInfo,
 ///     [
-///          (i2c::DeviceId::new(c_str!("rust_driver_i2c")), ())
+///          (i2c::DeviceId::new(c"rust_driver_i2c"), ())
 ///     ]
 /// );
 ///
@@ -280,7 +280,7 @@ macro_rules! module_i2c_driver {
 ///     MODULE_OF_TABLE,
 ///     <MyDriver as i2c::Driver>::IdInfo,
 ///     [
-///         (of::DeviceId::new(c_str!("test,device")), ())
+///         (of::DeviceId::new(c"test,device"), ())
 ///     ]
 /// );
 ///

-- 
2.52.0


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

* [PATCH 2/2] samples: rust: i2c: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:14 [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2025-12-22 12:14 ` [PATCH 1/2] " Tamir Duberstein
@ 2025-12-22 12:14 ` Tamir Duberstein
  2025-12-22 14:37 ` [PATCH 0/2] " Daniel Almeida
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Tamir Duberstein @ 2025-12-22 12:14 UTC (permalink / raw)
  To: Igor Korotin, Danilo Krummrich, Daniel Almeida, Miguel Ojeda,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

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.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 samples/rust/rust_driver_i2c.rs | 7 +++----
 samples/rust/rust_i2c_client.rs | 7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/samples/rust/rust_driver_i2c.rs b/samples/rust/rust_driver_i2c.rs
index ecefeca3e22f..6be79f9e9fb5 100644
--- a/samples/rust/rust_driver_i2c.rs
+++ b/samples/rust/rust_driver_i2c.rs
@@ -4,7 +4,6 @@
 
 use kernel::{
     acpi,
-    c_str,
     device::Core,
     i2c,
     of,
@@ -17,21 +16,21 @@
     ACPI_TABLE,
     MODULE_ACPI_TABLE,
     <SampleDriver as i2c::Driver>::IdInfo,
-    [(acpi::DeviceId::new(c_str!("LNUXBEEF")), 0)]
+    [(acpi::DeviceId::new(c"LNUXBEEF"), 0)]
 }
 
 kernel::i2c_device_table! {
     I2C_TABLE,
     MODULE_I2C_TABLE,
     <SampleDriver as i2c::Driver>::IdInfo,
-    [(i2c::DeviceId::new(c_str!("rust_driver_i2c")), 0)]
+    [(i2c::DeviceId::new(c"rust_driver_i2c"), 0)]
 }
 
 kernel::of_device_table! {
     OF_TABLE,
     MODULE_OF_TABLE,
     <SampleDriver as i2c::Driver>::IdInfo,
-    [(of::DeviceId::new(c_str!("test,rust_driver_i2c")), 0)]
+    [(of::DeviceId::new(c"test,rust_driver_i2c"), 0)]
 }
 
 impl i2c::Driver for SampleDriver {
diff --git a/samples/rust/rust_i2c_client.rs b/samples/rust/rust_i2c_client.rs
index f67938396dce..8d2c12e535b0 100644
--- a/samples/rust/rust_i2c_client.rs
+++ b/samples/rust/rust_i2c_client.rs
@@ -69,7 +69,6 @@
 
 use kernel::{
     acpi,
-    c_str,
     device,
     devres::Devres,
     i2c,
@@ -90,20 +89,20 @@ struct SampleDriver {
     OF_TABLE,
     MODULE_OF_TABLE,
     <SampleDriver as platform::Driver>::IdInfo,
-    [(of::DeviceId::new(c_str!("test,rust-device")), ())]
+    [(of::DeviceId::new(c"test,rust-device"), ())]
 );
 
 kernel::acpi_device_table!(
     ACPI_TABLE,
     MODULE_ACPI_TABLE,
     <SampleDriver as platform::Driver>::IdInfo,
-    [(acpi::DeviceId::new(c_str!("LNUXBEEF")), ())]
+    [(acpi::DeviceId::new(c"LNUXBEEF"), ())]
 );
 
 const SAMPLE_I2C_CLIENT_ADDR: u16 = 0x30;
 const SAMPLE_I2C_ADAPTER_INDEX: i32 = 0;
 const BOARD_INFO: i2c::I2cBoardInfo =
-    i2c::I2cBoardInfo::new(c_str!("rust_driver_i2c"), SAMPLE_I2C_CLIENT_ADDR);
+    i2c::I2cBoardInfo::new(c"rust_driver_i2c", SAMPLE_I2C_CLIENT_ADDR);
 
 impl platform::Driver for SampleDriver {
     type IdInfo = ();

-- 
2.52.0


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

* Re: [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:14 [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2025-12-22 12:14 ` [PATCH 1/2] " Tamir Duberstein
  2025-12-22 12:14 ` [PATCH 2/2] samples: " Tamir Duberstein
@ 2025-12-22 14:37 ` Daniel Almeida
  2025-12-22 18:17 ` Igor Korotin
  2026-01-19  8:20 ` Miguel Ojeda
  4 siblings, 0 replies; 7+ messages in thread
From: Daniel Almeida @ 2025-12-22 14:37 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Igor Korotin, Danilo Krummrich, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, rust-for-linux, linux-kernel,
	Tamir Duberstein



> On 22 Dec 2025, at 09:14, 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>
> ---
> Tamir Duberstein (2):
>      rust: i2c: replace `kernel::c_str!` with C-Strings
>      samples: rust: i2c: replace `kernel::c_str!` with C-Strings
> 
> rust/kernel/i2c.rs              | 8 ++++----
> samples/rust/rust_driver_i2c.rs | 7 +++----
> samples/rust/rust_i2c_client.rs | 7 +++----
> 3 files changed, 10 insertions(+), 12 deletions(-)
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-i2c-fce258eb7e5d
> 
> Best regards,
> --  
> Tamir Duberstein <tamird@gmail.com>
> 


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

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

* Re: [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:14 [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings Tamir Duberstein
                   ` (2 preceding siblings ...)
  2025-12-22 14:37 ` [PATCH 0/2] " Daniel Almeida
@ 2025-12-22 18:17 ` Igor Korotin
  2025-12-22 18:45   ` Miguel Ojeda
  2026-01-19  8:20 ` Miguel Ojeda
  4 siblings, 1 reply; 7+ messages in thread
From: Igor Korotin @ 2025-12-22 18:17 UTC (permalink / raw)
  To: Tamir Duberstein, Danilo Krummrich, Daniel Almeida, Miguel Ojeda,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

On 12/22/2025 12:14 PM, Tamir Duberstein 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>
> ---
> Tamir Duberstein (2):
>        rust: i2c: replace `kernel::c_str!` with C-Strings
>        samples: rust: i2c: replace `kernel::c_str!` with C-Strings
> 
>   rust/kernel/i2c.rs              | 8 ++++----
>   samples/rust/rust_driver_i2c.rs | 7 +++----
>   samples/rust/rust_i2c_client.rs | 7 +++----
>   3 files changed, 10 insertions(+), 12 deletions(-)
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-i2c-fce258eb7e5d
> 
> Best regards,
> --
> Tamir Duberstein <tamird@gmail.com>
> 

Acked-by: Igor Korotin<igor.korotin.linux@gmail.com>

Since I don’t yet have a public kernel tree, I’d appreciate it if 
someone could pick this up through their tree.

Thanks
Igor

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

* Re: [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings
  2025-12-22 18:17 ` Igor Korotin
@ 2025-12-22 18:45   ` Miguel Ojeda
  0 siblings, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-12-22 18:45 UTC (permalink / raw)
  To: Igor Korotin
  Cc: Tamir Duberstein, Danilo Krummrich, Daniel Almeida, Miguel Ojeda,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux,
	linux-kernel, Tamir Duberstein

On Mon, Dec 22, 2025 at 7:17 PM Igor Korotin
<igor.korotin.linux@gmail.com> wrote:
>
> Acked-by: Igor Korotin<igor.korotin.linux@gmail.com>
>
> Since I don’t yet have a public kernel tree, I’d appreciate it if
> someone could pick this up through their tree.

I can do that.

Cheers,
Miguel

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

* Re: [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:14 [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings Tamir Duberstein
                   ` (3 preceding siblings ...)
  2025-12-22 18:17 ` Igor Korotin
@ 2026-01-19  8:20 ` Miguel Ojeda
  4 siblings, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2026-01-19  8:20 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Igor Korotin, Danilo Krummrich, Daniel Almeida, Miguel Ojeda,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux,
	linux-kernel, Tamir Duberstein

On Mon, Dec 22, 2025 at 1:14 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>

Applied to `rust-next` -- thanks everyone!

Cheers,
Miguel

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

end of thread, other threads:[~2026-01-19  8:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 12:14 [PATCH 0/2] rust: i2c: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2025-12-22 12:14 ` [PATCH 1/2] " Tamir Duberstein
2025-12-22 12:14 ` [PATCH 2/2] samples: " Tamir Duberstein
2025-12-22 14:37 ` [PATCH 0/2] " Daniel Almeida
2025-12-22 18:17 ` Igor Korotin
2025-12-22 18:45   ` Miguel Ojeda
2026-01-19  8:20 ` Miguel Ojeda

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