mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
@ 2025-12-22 12:16 Tamir Duberstein
  2025-12-22 14:33 ` Daniel Almeida
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tamir Duberstein @ 2025-12-22 12:16 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: linux-clk, rust-for-linux, linux-kernel, Tamir Duberstein,
	Greg Kroah-Hartman, Viresh Kumar

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: Stephen Boyd <sboyd@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 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 c1cfaeaa36a2..68a0c2f4e318 100644
--- a/rust/kernel/clk.rs
+++ b/rust/kernel/clk.rs
@@ -104,13 +104,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()?;
     ///

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cstr-clk-122a1428b919

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


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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:16 [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings Tamir Duberstein
@ 2025-12-22 14:33 ` Daniel Almeida
  2026-01-04  2:29 ` Tamir Duberstein
  2026-01-30  4:42 ` Miguel Ojeda
  2 siblings, 0 replies; 9+ messages in thread
From: Daniel Almeida @ 2025-12-22 14:33 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-clk,
	rust-for-linux, linux-kernel, Tamir Duberstein,
	Greg Kroah-Hartman, Viresh Kumar



> On 22 Dec 2025, at 09:16, 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: Stephen Boyd <sboyd@kernel.org>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> 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 c1cfaeaa36a2..68a0c2f4e318 100644
> --- a/rust/kernel/clk.rs
> +++ b/rust/kernel/clk.rs
> @@ -104,13 +104,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()?;
>     ///
> 
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-clk-122a1428b919
> 
> Best regards,
> --  
> Tamir Duberstein <tamird@gmail.com>
> 
> 

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


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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:16 [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2025-12-22 14:33 ` Daniel Almeida
@ 2026-01-04  2:29 ` Tamir Duberstein
  2026-01-19 12:51   ` Tamir Duberstein
  2026-01-30  4:42 ` Miguel Ojeda
  2 siblings, 1 reply; 9+ messages in thread
From: Tamir Duberstein @ 2026-01-04  2:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: linux-clk, rust-for-linux, linux-kernel, Greg Kroah-Hartman,
	Viresh Kumar

On Mon, Dec 22, 2025 at 7:17 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: Stephen Boyd <sboyd@kernel.org>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
>  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 c1cfaeaa36a2..68a0c2f4e318 100644
> --- a/rust/kernel/clk.rs
> +++ b/rust/kernel/clk.rs
> @@ -104,13 +104,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()?;
>      ///
>
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-clk-122a1428b919
>
> Best regards,
> --
> Tamir Duberstein <tamird@gmail.com>
>

@Stephen could you please have a look?

Cheers.
Tamir

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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2026-01-04  2:29 ` Tamir Duberstein
@ 2026-01-19 12:51   ` Tamir Duberstein
  2026-01-19 17:59     ` Miguel Ojeda
  0 siblings, 1 reply; 9+ messages in thread
From: Tamir Duberstein @ 2026-01-19 12:51 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: linux-clk, rust-for-linux, linux-kernel, Greg Kroah-Hartman,
	Viresh Kumar

On Sat, Jan 3, 2026 at 9:29 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
> On Mon, Dec 22, 2025 at 7:17 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: Stephen Boyd <sboyd@kernel.org>
> > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> > ---
> >  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 c1cfaeaa36a2..68a0c2f4e318 100644
> > --- a/rust/kernel/clk.rs
> > +++ b/rust/kernel/clk.rs
> > @@ -104,13 +104,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()?;
> >      ///
> >
> > ---
> > base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> > change-id: 20251222-cstr-clk-122a1428b919
> >
> > Best regards,
> > --
> > Tamir Duberstein <tamird@gmail.com>
> >
>
> @Stephen could you please have a look?
>
> Cheers.
> Tamir

Michael or Stephen: could you take this through clk or would you be ok
with it going through rust-next?

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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2026-01-19 12:51   ` Tamir Duberstein
@ 2026-01-19 17:59     ` Miguel Ojeda
  2026-01-27 14:14       ` Tamir Duberstein
  0 siblings, 1 reply; 9+ messages in thread
From: Miguel Ojeda @ 2026-01-19 17:59 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-clk,
	rust-for-linux, linux-kernel, Greg Kroah-Hartman, Viresh Kumar

On Mon, Jan 19, 2026 at 1:52 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
> Michael or Stephen: could you take this through clk or would you be ok
> with it going through rust-next?

Either seems good to me, thanks!

For context, this is part of a long migration:

    https://github.com/Rust-for-Linux/linux/issues/1075
    https://lore.kernel.org/all/20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com/

Cheers,
Miguel

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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2026-01-19 17:59     ` Miguel Ojeda
@ 2026-01-27 14:14       ` Tamir Duberstein
  2026-01-27 14:27         ` Miguel Ojeda
  0 siblings, 1 reply; 9+ messages in thread
From: Tamir Duberstein @ 2026-01-27 14:14 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-clk,
	rust-for-linux, linux-kernel, Greg Kroah-Hartman, Viresh Kumar

On Mon, Jan 19, 2026 at 1:00 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Mon, Jan 19, 2026 at 1:52 PM Tamir Duberstein <tamird@gmail.com> wrote:
> >
> > Michael or Stephen: could you take this through clk or would you be ok
> > with it going through rust-next?
>
> Either seems good to me, thanks!
>
> For context, this is part of a long migration:
>
>     https://github.com/Rust-for-Linux/linux/issues/1075
>     https://lore.kernel.org/all/20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com/
>
> Cheers,
> Miguel

Another ping here, folks! Miguel, what can we do if we do not hear
from the clk maintainers?

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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2026-01-27 14:14       ` Tamir Duberstein
@ 2026-01-27 14:27         ` Miguel Ojeda
  2026-01-27 16:15           ` Tamir Duberstein
  0 siblings, 1 reply; 9+ messages in thread
From: Miguel Ojeda @ 2026-01-27 14:27 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-clk,
	rust-for-linux, linux-kernel, Greg Kroah-Hartman, Viresh Kumar

On Tue, Jan 27, 2026 at 3:14 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
> Another ping here, folks! Miguel, what can we do if we do not hear
> from the clk maintainers?

Stephen already Acked-by this one, right?

So I assume they were OK with me taking it -- I will do that unless
someone shouts.

Thanks!

Cheers,
Miguel

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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2026-01-27 14:27         ` Miguel Ojeda
@ 2026-01-27 16:15           ` Tamir Duberstein
  0 siblings, 0 replies; 9+ messages in thread
From: Tamir Duberstein @ 2026-01-27 16:15 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-clk,
	rust-for-linux, linux-kernel, Greg Kroah-Hartman, Viresh Kumar

On Tue, Jan 27, 2026 at 9:27 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Jan 27, 2026 at 3:14 PM Tamir Duberstein <tamird@gmail.com> wrote:
> >
> > Another ping here, folks! Miguel, what can we do if we do not hear
> > from the clk maintainers?
>
> Stephen already Acked-by this one, right?
>
> So I assume they were OK with me taking it -- I will do that unless
> someone shouts.

Great, thanks!

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

* Re: [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings
  2025-12-22 12:16 [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2025-12-22 14:33 ` Daniel Almeida
  2026-01-04  2:29 ` Tamir Duberstein
@ 2026-01-30  4:42 ` Miguel Ojeda
  2 siblings, 0 replies; 9+ messages in thread
From: Miguel Ojeda @ 2026-01-30  4:42 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Michael Turquette, Stephen Boyd, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-clk,
	rust-for-linux, linux-kernel, Tamir Duberstein,
	Greg Kroah-Hartman, Viresh Kumar

On Mon, Dec 22, 2025 at 1:17 PM 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: Stephen Boyd <sboyd@kernel.org>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Applied to `rust-next` -- thanks everyone!

Cheers,
Miguel

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

end of thread, other threads:[~2026-01-30  4:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-22 12:16 [PATCH] rust: clk: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2025-12-22 14:33 ` Daniel Almeida
2026-01-04  2:29 ` Tamir Duberstein
2026-01-19 12:51   ` Tamir Duberstein
2026-01-19 17:59     ` Miguel Ojeda
2026-01-27 14:14       ` Tamir Duberstein
2026-01-27 14:27         ` Miguel Ojeda
2026-01-27 16:15           ` Tamir Duberstein
2026-01-30  4:42 ` Miguel Ojeda

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

all inboxes | Powered by JetHome®