[PATCH v13 4/5] rust: replace `kernel::c_str!` with C-Strings

Benno Lossin lossin at kernel.org
Fri Jul 4 13:01:23 UTC 2025


On Tue Jul 1, 2025 at 6:49 PM CEST, Tamir Duberstein wrote:
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible and rename
> `kernel::c_str!` to `str_to_cstr!` to clarify its intended use.

These two things can also be split? And it should also be possible to do
this by-subsystem, right?

---
Cheers,
Benno

> Closes: https://github.com/Rust-for-Linux/linux/issues/1075
> Acked-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> Reviewed-by: Alice Ryhl <aliceryhl at google.com>
> Signed-off-by: Tamir Duberstein <tamird at gmail.com>
> ---
>  drivers/block/rnull.rs                |  2 +-
>  drivers/cpufreq/rcpufreq_dt.rs        |  5 ++---
>  drivers/gpu/drm/nova/driver.rs        | 10 +++++-----
>  drivers/gpu/nova-core/driver.rs       |  6 +++---
>  drivers/net/phy/ax88796b_rust.rs      |  7 +++----
>  drivers/net/phy/qt2025.rs             |  5 ++---
>  rust/kernel/clk.rs                    |  6 ++----
>  rust/kernel/configfs.rs               |  9 +++++----
>  rust/kernel/cpufreq.rs                |  3 +--
>  rust/kernel/devres.rs                 |  2 +-
>  rust/kernel/drm/ioctl.rs              |  2 +-
>  rust/kernel/firmware.rs               |  6 +++---
>  rust/kernel/kunit.rs                  | 14 ++++++--------
>  rust/kernel/net/phy.rs                |  6 ++----
>  rust/kernel/platform.rs               |  4 ++--
>  rust/kernel/str.rs                    | 24 ++++++++++++++++--------
>  rust/kernel/sync.rs                   |  7 +++----
>  rust/kernel/sync/completion.rs        |  2 +-
>  rust/kernel/sync/lock/global.rs       |  3 ++-
>  rust/kernel/workqueue.rs              |  8 ++++----
>  rust/macros/kunit.rs                  | 10 +++++-----
>  rust/macros/module.rs                 |  2 +-
>  samples/rust/rust_configfs.rs         |  5 ++---
>  samples/rust/rust_driver_auxiliary.rs |  4 ++--
>  samples/rust/rust_driver_faux.rs      |  4 ++--
>  samples/rust/rust_driver_pci.rs       |  4 ++--
>  samples/rust/rust_driver_platform.rs  |  4 ++--
>  samples/rust/rust_misc_device.rs      |  3 +--
>  scripts/rustdoc_test_gen.rs           |  4 ++--
>  29 files changed, 84 insertions(+), 87 deletions(-)


More information about the dri-devel mailing list