From: Tamir Duberstein Date: Mon, 22 Dec 2025 12:29:32 +0000 (+0100) Subject: rust: cpufreq: replace `kernel::c_str!` with C-Strings X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e05d9e5c8b754cc7d72acd896f5f7caf6b78a973;p=thirdparty%2Flinux.git rust: cpufreq: 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 Reviewed-by: Alice Ryhl Reviewed-by: Benno Lossin Signed-off-by: Tamir Duberstein Reviewed-by: Daniel Almeida Acked-by: Danilo Krummrich Signed-off-by: Viresh Kumar --- diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs index 31e07f0279dbd..f17bf64c22e2c 100644 --- a/drivers/cpufreq/rcpufreq_dt.rs +++ b/drivers/cpufreq/rcpufreq_dt.rs @@ -3,7 +3,6 @@ //! Rust based implementation of the cpufreq-dt driver. use kernel::{ - c_str, clk::Clk, cpu, cpufreq, cpumask::CpumaskVar, @@ -52,7 +51,7 @@ impl opp::ConfigOps for CPUFreqDTDriver {} #[vtable] impl cpufreq::Driver for CPUFreqDTDriver { - const NAME: &'static CStr = c_str!("cpufreq-dt"); + const NAME: &'static CStr = c"cpufreq-dt"; const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK | cpufreq::flags::IS_COOLING_DEV; const BOOST_ENABLED: bool = true; @@ -197,7 +196,7 @@ kernel::of_device_table!( OF_TABLE, MODULE_OF_TABLE, ::IdInfo, - [(of::DeviceId::new(c_str!("operating-points-v2")), ())] + [(of::DeviceId::new(c"operating-points-v2"), ())] ); impl platform::Driver for CPUFreqDTDriver { diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs index 0879a79485f8e..76faa1ac85017 100644 --- a/rust/kernel/cpufreq.rs +++ b/rust/kernel/cpufreq.rs @@ -840,7 +840,6 @@ pub trait Driver { /// ``` /// use kernel::{ /// cpufreq, -/// c_str, /// device::{Core, Device}, /// macros::vtable, /// of, platform, @@ -853,7 +852,7 @@ pub trait Driver { /// /// #[vtable] /// impl cpufreq::Driver for SampleDriver { -/// const NAME: &'static CStr = c_str!("cpufreq-sample"); +/// const NAME: &'static CStr = c"cpufreq-sample"; /// const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK | cpufreq::flags::IS_COOLING_DEV; /// const BOOST_ENABLED: bool = true; ///