]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
samples: rust: faux: replace `kernel::c_str!` with C-Strings
authorTamir Duberstein <tamird@gmail.com>
Tue, 23 Dec 2025 07:40:24 +0000 (08:40 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 23 Dec 2025 10:44:36 +0000 (11:44 +0100)
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>
samples/rust/rust_driver_faux.rs

index ecc9fd378cbd3704e4f2afbc90fa91b95b62590f..5330b77ea9862206326da5f30ecdb19e86960611 100644 (file)
@@ -2,7 +2,11 @@
 
 //! Rust faux device sample.
 
-use kernel::{c_str, faux, prelude::*, Module};
+use kernel::{
+    faux,
+    prelude::*,
+    Module, //
+};
 
 module! {
     type: SampleModule,
@@ -20,7 +24,7 @@ impl Module for SampleModule {
     fn init(_module: &'static ThisModule) -> Result<Self> {
         pr_info!("Initialising Rust Faux Device Sample\n");
 
-        let reg = faux::Registration::new(c_str!("rust-faux-sample-device"), None)?;
+        let reg = faux::Registration::new(c"rust-faux-sample-device", None)?;
 
         dev_info!(reg.as_ref(), "Hello from faux device!\n");