Thread (22 messages) 22 messages, 5 authors, 2025-08-05
STALE327d REVIEWED: 30 (30M)

[PATCH 04/17] rust: clk: replace `kernel::c_str!` with C-Strings

From: Tamir Duberstein <hidden>
Date: 2025-07-10 15:31:43
Also in: dri-devel, linux-block, linux-clk, linux-kselftest, linux-pci, linux-pm, lkml, nouveau, rust-for-linux
Subsystem: common clk framework, rust, the rest · Maintainers: Michael Turquette, Stephen Boyd, Miguel Ojeda, Linus Torvalds

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>
Signed-off-by: Tamir Duberstein <redacted>
---
 rust/kernel/clk.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs
index 34a19bc99990..fb0f259cf231 100644
--- a/rust/kernel/clk.rs
+++ b/rust/kernel/clk.rs
@@ -100,13 +100,12 @@ mod common_clk {
     /// The following example demonstrates how to obtain and configure a clock for a device.
     ///
     /// ```
-    /// use kernel::c_str;
     /// use kernel::clk::{Clk, Hertz};
     /// use kernel::device::Device;
     /// use kernel::error::Result;
     ///
     /// fn configure_clk(dev: &Device) -> Result {
-    ///     let clk = Clk::get(dev, Some(c_str!("apb_clk")))?;
+    ///     let clk = Clk::get(dev, Some(c"apb_clk"))?;
     ///
     ///     clk.prepare_enable()?;
     ///
@@ -272,13 +271,12 @@ fn drop(&mut self) {
     /// device. The code functions correctly whether or not the clock is available.
     ///
     /// ```
-    /// use kernel::c_str;
     /// use kernel::clk::{OptionalClk, Hertz};
     /// use kernel::device::Device;
     /// use kernel::error::Result;
     ///
     /// fn configure_clk(dev: &Device) -> Result {
-    ///     let clk = OptionalClk::get(dev, Some(c_str!("apb_clk")))?;
+    ///     let clk = OptionalClk::get(dev, Some(c"apb_clk"))?;
     ///
     ///     clk.prepare_enable()?;
     ///
-- 
2.50.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help