Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

samples: rust: faux: replace `kernel::c_str!` with C-Strings

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>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://patch.msgid.link/20251223-cstr-faux-v1-1-ee0c5cf1be4b@gmail.com
[ Use kernel vertical import style. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Tamir Duberstein and committed by
Danilo Krummrich
43e35185 185c8146

+6 -2
+6 -2
samples/rust/rust_driver_faux.rs
··· 2 2 3 3 //! Rust faux device sample. 4 4 5 - use kernel::{c_str, faux, prelude::*, Module}; 5 + use kernel::{ 6 + faux, 7 + prelude::*, 8 + Module, // 9 + }; 6 10 7 11 module! { 8 12 type: SampleModule, ··· 24 20 fn init(_module: &'static ThisModule) -> Result<Self> { 25 21 pr_info!("Initialising Rust Faux Device Sample\n"); 26 22 27 - let reg = faux::Registration::new(c_str!("rust-faux-sample-device"), None)?; 23 + let reg = faux::Registration::new(c"rust-faux-sample-device", None)?; 28 24 29 25 dev_info!(reg.as_ref(), "Hello from faux device!\n"); 30 26