[PATCH] rust: sync: replace `kernel::c_str!` with C-Strings
From: Tamir Duberstein
Date: Tue Jan 20 2026 - 16:13:32 EST
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@xxxxxxxxxx>
---
This is the same as my earlier change[0] but applies to additional
code[1] which didn't make it to mainline in a timely manner and is now
queued for v7.0.
Link: https://lore.kernel.org/all/20251117-core-cstr-cstrings-v4-1-924886ad9f75@xxxxxxxxx/ [0]
Link: https://lore.kernel.org/all/20250811-lock-class-key-cleanup-v3-2-b12967ee1ca2@xxxxxxxxxx/ [1]
---
rust/kernel/sync.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs
index b10e576221ff..993dbf2caa0e 100644
--- a/rust/kernel/sync.rs
+++ b/rust/kernel/sync.rs
@@ -126,13 +126,12 @@ fn drop(self: Pin<&mut Self>) {
/// # Examples
///
/// ```
-/// use kernel::c_str;
/// use kernel::sync::{static_lock_class, Arc, SpinLock};
///
/// fn new_locked_int() -> Result<Arc<SpinLock<u32>>> {
/// Arc::pin_init(SpinLock::new(
/// 42,
-/// c_str!("new_locked_int"),
+/// c"new_locked_int",
/// static_lock_class!(),
/// ), GFP_KERNEL)
/// }
---
base-commit: d08c85ac8894995d4b0d8fb48d2f6a3e53cd79ab
change-id: 20260120-cstr-sync-again-5912d7479909
Best regards,
--
Tamir Duberstein <tamird@xxxxxxxxxx>