public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings
@ 2025-12-22 12:29 Tamir Duberstein
  2025-12-22 13:54 ` Daniel Almeida
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tamir Duberstein @ 2025-12-22 12:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: linux-pm, linux-kernel, rust-for-linux, Tamir Duberstein,
	Greg Kroah-Hartman

From: Tamir Duberstein <tamird@gmail.com>

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>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 drivers/cpufreq/rcpufreq_dt.rs | 5 ++---
 rust/kernel/cpufreq.rs         | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
index 31e07f0279db..f17bf64c22e2 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 @@ fn register_em(policy: &mut cpufreq::Policy) {
     OF_TABLE,
     MODULE_OF_TABLE,
     <CPUFreqDTDriver as platform::Driver>::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 f968fbd22890..8be634eaabe9 100644
--- a/rust/kernel/cpufreq.rs
+++ b/rust/kernel/cpufreq.rs
@@ -840,7 +840,6 @@ fn register_em(_policy: &mut Policy) {
 /// ```
 /// use kernel::{
 ///     cpufreq,
-///     c_str,
 ///     device::{Core, Device},
 ///     macros::vtable,
 ///     of, platform,
@@ -853,7 +852,7 @@ fn register_em(_policy: &mut Policy) {
 ///
 /// #[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;
 ///

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cstr-cpufreq-725cd36ca0f1

Best regards,
--  
Tamir Duberstein <tamird@gmail.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:29 [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings Tamir Duberstein
@ 2025-12-22 13:54 ` Daniel Almeida
  2026-01-04  2:31 ` Tamir Duberstein
  2026-01-05  5:01 ` Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Almeida @ 2025-12-22 13:54 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Rafael J. Wysocki, Viresh Kumar, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-pm,
	linux-kernel, rust-for-linux, Tamir Duberstein,
	Greg Kroah-Hartman



> On 22 Dec 2025, at 09:29, Tamir Duberstein <tamird@kernel.org> wrote:
> 
> From: Tamir Duberstein <tamird@gmail.com>
> 
> 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>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> drivers/cpufreq/rcpufreq_dt.rs | 5 ++---
> rust/kernel/cpufreq.rs         | 3 +--
> 2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
> index 31e07f0279db..f17bf64c22e2 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 @@ fn register_em(policy: &mut cpufreq::Policy) {
>     OF_TABLE,
>     MODULE_OF_TABLE,
>     <CPUFreqDTDriver as platform::Driver>::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 f968fbd22890..8be634eaabe9 100644
> --- a/rust/kernel/cpufreq.rs
> +++ b/rust/kernel/cpufreq.rs
> @@ -840,7 +840,6 @@ fn register_em(_policy: &mut Policy) {
> /// ```
> /// use kernel::{
> ///     cpufreq,
> -///     c_str,
> ///     device::{Core, Device},
> ///     macros::vtable,
> ///     of, platform,
> @@ -853,7 +852,7 @@ fn register_em(_policy: &mut Policy) {
> ///
> /// #[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;
> ///
> 
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-cpufreq-725cd36ca0f1
> 
> Best regards,
> --  
> Tamir Duberstein <tamird@gmail.com>
> 
> 

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:29 [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2025-12-22 13:54 ` Daniel Almeida
@ 2026-01-04  2:31 ` Tamir Duberstein
  2026-01-05  5:01 ` Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Tamir Duberstein @ 2026-01-04  2:31 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: linux-pm, linux-kernel, rust-for-linux, Greg Kroah-Hartman

On Mon, Dec 22, 2025 at 7:29 AM Tamir Duberstein <tamird@kernel.org> wrote:
>
> From: Tamir Duberstein <tamird@gmail.com>
>
> 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>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
>  drivers/cpufreq/rcpufreq_dt.rs | 5 ++---
>  rust/kernel/cpufreq.rs         | 3 +--
>  2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
> index 31e07f0279db..f17bf64c22e2 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 @@ fn register_em(policy: &mut cpufreq::Policy) {
>      OF_TABLE,
>      MODULE_OF_TABLE,
>      <CPUFreqDTDriver as platform::Driver>::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 f968fbd22890..8be634eaabe9 100644
> --- a/rust/kernel/cpufreq.rs
> +++ b/rust/kernel/cpufreq.rs
> @@ -840,7 +840,6 @@ fn register_em(_policy: &mut Policy) {
>  /// ```
>  /// use kernel::{
>  ///     cpufreq,
> -///     c_str,
>  ///     device::{Core, Device},
>  ///     macros::vtable,
>  ///     of, platform,
> @@ -853,7 +852,7 @@ fn register_em(_policy: &mut Policy) {
>  ///
>  /// #[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;
>  ///
>
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-cpufreq-725cd36ca0f1
>
> Best regards,
> --
> Tamir Duberstein <tamird@gmail.com>
>

@Rafael could you please have a look?

Cheers.
Tamir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:29 [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2025-12-22 13:54 ` Daniel Almeida
  2026-01-04  2:31 ` Tamir Duberstein
@ 2026-01-05  5:01 ` Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2026-01-05  5:01 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Rafael J. Wysocki, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, linux-pm, linux-kernel,
	rust-for-linux, Tamir Duberstein, Greg Kroah-Hartman

On 22-12-25, 13:29, Tamir Duberstein wrote:
> From: Tamir Duberstein <tamird@gmail.com>
> 
> 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>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
>  drivers/cpufreq/rcpufreq_dt.rs | 5 ++---
>  rust/kernel/cpufreq.rs         | 3 +--
>  2 files changed, 3 insertions(+), 5 deletions(-)

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-05  5:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 12:29 [PATCH] rust: cpufreq: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2025-12-22 13:54 ` Daniel Almeida
2026-01-04  2:31 ` Tamir Duberstein
2026-01-05  5:01 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox