[PATCH 0/7] driver-core: rust: replace `kernel::c_str!` with C-Strings

Tamir Duberstein posted 7 patches 1 month, 2 weeks ago
rust/kernel/debugfs.rs                | 23 +++++++++--------------
rust/kernel/device.rs                 |  4 +---
rust/kernel/device/property.rs        |  6 +++---
rust/kernel/io/mem.rs                 |  7 +++----
rust/kernel/irq/request.rs            |  6 ++----
rust/kernel/platform.rs               |  6 +++---
samples/rust/rust_debugfs.rs          | 17 ++++++++---------
samples/rust/rust_debugfs_scoped.rs   | 20 ++++++++------------
samples/rust/rust_driver_auxiliary.rs |  4 ++--
samples/rust/rust_driver_faux.rs      |  4 ++--
samples/rust/rust_driver_platform.rs  | 30 ++++++++++++++----------------
11 files changed, 55 insertions(+), 72 deletions(-)
[PATCH 0/7] driver-core: rust: replace `kernel::c_str!` with C-Strings
Posted by Tamir Duberstein 1 month, 2 weeks ago
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 (7):
      rust: auxiliary: replace `kernel::c_str!` with C-Strings
      rust: device: replace `kernel::c_str!` with C-Strings
      rust: platform: replace `kernel::c_str!` with C-Strings
      rust: io: replace `kernel::c_str!` with C-Strings
      rust: irq: replace `kernel::c_str!` with C-Strings
      rust: debugfs: replace `kernel::c_str!` with C-Strings
      samples: rust: debugfs: replace `kernel::c_str!` with C-Strings

 rust/kernel/debugfs.rs                | 23 +++++++++--------------
 rust/kernel/device.rs                 |  4 +---
 rust/kernel/device/property.rs        |  6 +++---
 rust/kernel/io/mem.rs                 |  7 +++----
 rust/kernel/irq/request.rs            |  6 ++----
 rust/kernel/platform.rs               |  6 +++---
 samples/rust/rust_debugfs.rs          | 17 ++++++++---------
 samples/rust/rust_debugfs_scoped.rs   | 20 ++++++++------------
 samples/rust/rust_driver_auxiliary.rs |  4 ++--
 samples/rust/rust_driver_faux.rs      |  4 ++--
 samples/rust/rust_driver_platform.rs  | 30 ++++++++++++++----------------
 11 files changed, 55 insertions(+), 72 deletions(-)
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cstr-driver-core-8bf66543f532

Best regards,
--  
Tamir Duberstein <tamird@gmail.com>
Re: [PATCH 0/7] driver-core: rust: replace `kernel::c_str!` with C-Strings
Posted by Daniel Almeida 1 month, 2 weeks ago

> On 22 Dec 2025, at 09:35, 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 (7):
>      rust: auxiliary: replace `kernel::c_str!` with C-Strings
>      rust: device: replace `kernel::c_str!` with C-Strings
>      rust: platform: replace `kernel::c_str!` with C-Strings
>      rust: io: replace `kernel::c_str!` with C-Strings
>      rust: irq: replace `kernel::c_str!` with C-Strings
>      rust: debugfs: replace `kernel::c_str!` with C-Strings
>      samples: rust: debugfs: replace `kernel::c_str!` with C-Strings
> 
> rust/kernel/debugfs.rs                | 23 +++++++++--------------
> rust/kernel/device.rs                 |  4 +---
> rust/kernel/device/property.rs        |  6 +++---
> rust/kernel/io/mem.rs                 |  7 +++----
> rust/kernel/irq/request.rs            |  6 ++----
> rust/kernel/platform.rs               |  6 +++---
> samples/rust/rust_debugfs.rs          | 17 ++++++++---------
> samples/rust/rust_debugfs_scoped.rs   | 20 ++++++++------------
> samples/rust/rust_driver_auxiliary.rs |  4 ++--
> samples/rust/rust_driver_faux.rs      |  4 ++--
> samples/rust/rust_driver_platform.rs  | 30 ++++++++++++++----------------
> 11 files changed, 55 insertions(+), 72 deletions(-)
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-driver-core-8bf66543f532
> 
> Best regards,
> --  
> Tamir Duberstein <tamird@gmail.com>
> 

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Re: [PATCH 0/7] driver-core: rust: replace `kernel::c_str!` with C-Strings
Posted by Danilo Krummrich 1 month, 2 weeks ago
On Mon Dec 22, 2025 at 1:35 PM CET, Tamir Duberstein wrote:

Applied to driver-core-testing, thanks!

> Tamir Duberstein (7):
>       rust: auxiliary: replace `kernel::c_str!` with C-Strings
>       rust: device: replace `kernel::c_str!` with C-Strings
>       rust: platform: replace `kernel::c_str!` with C-Strings

    [ Use kernel vertical import style; discard unrelated faux changes.
      - Danilo ]

>       rust: io: replace `kernel::c_str!` with C-Strings

    [ Use kernel vertical import style. - Danilo ]

>       rust: irq: replace `kernel::c_str!` with C-Strings
>       rust: debugfs: replace `kernel::c_str!` with C-Strings
>       samples: rust: debugfs: replace `kernel::c_str!` with C-Strings

@Tamir: Can you please send a separate patch for the faux bus?
Re: [PATCH 0/7] driver-core: rust: replace `kernel::c_str!` with C-Strings
Posted by Tamir Duberstein 1 month, 2 weeks ago
On Mon, Dec 22, 2025 at 5:46 PM Danilo Krummrich <dakr@kernel.org> wrote:
>
> On Mon Dec 22, 2025 at 1:35 PM CET, Tamir Duberstein wrote:
>
> Applied to driver-core-testing, thanks!
>
> > Tamir Duberstein (7):
> >       rust: auxiliary: replace `kernel::c_str!` with C-Strings
> >       rust: device: replace `kernel::c_str!` with C-Strings
> >       rust: platform: replace `kernel::c_str!` with C-Strings
>
>     [ Use kernel vertical import style; discard unrelated faux changes.
>       - Danilo ]
>
> >       rust: io: replace `kernel::c_str!` with C-Strings
>
>     [ Use kernel vertical import style. - Danilo ]
>
> >       rust: irq: replace `kernel::c_str!` with C-Strings
> >       rust: debugfs: replace `kernel::c_str!` with C-Strings
> >       samples: rust: debugfs: replace `kernel::c_str!` with C-Strings
>
> @Tamir: Can you please send a separate patch for the faux bus?

Sure!

https://lore.kernel.org/all/20251223-cstr-faux-v1-1-ee0c5cf1be4b@gmail.com/