From: Daniel Almeida <daniel.almeida@collabora.com>
To: Tamir Duberstein <tamird@kernel.org>
Cc: "Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
"Tamir Duberstein" <tamird@gmail.com>
Subject: Re: [PATCH] rust: regulator: replace `kernel::c_str!` with C-Strings
Date: Mon, 22 Dec 2025 11:35:35 -0300 [thread overview]
Message-ID: <1B3A437A-5A9E-4109-A202-CD3172596929@collabora.com> (raw)
In-Reply-To: <20251222-cstr-regulator-v1-1-430e3d517025@gmail.com>
> On 22 Dec 2025, at 09:15, 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.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> rust/kernel/regulator.rs | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/rust/kernel/regulator.rs b/rust/kernel/regulator.rs
> index 2c44827ad0b7..4f7837c7e53a 100644
> --- a/rust/kernel/regulator.rs
> +++ b/rust/kernel/regulator.rs
> @@ -122,12 +122,11 @@ pub fn devm_enable_optional(dev: &Device<Bound>, name: &CStr) -> Result {
> ///
> /// ```
> /// # use kernel::prelude::*;
> -/// # use kernel::c_str;
> /// # use kernel::device::Device;
> /// # use kernel::regulator::{Voltage, Regulator, Disabled, Enabled};
> /// fn enable(dev: &Device, min_voltage: Voltage, max_voltage: Voltage) -> Result {
> /// // Obtain a reference to a (fictitious) regulator.
> -/// let regulator: Regulator<Disabled> = Regulator::<Disabled>::get(dev, c_str!("vcc"))?;
> +/// let regulator: Regulator<Disabled> = Regulator::<Disabled>::get(dev, c"vcc")?;
> ///
> /// // The voltage can be set before enabling the regulator if needed, e.g.:
> /// regulator.set_voltage(min_voltage, max_voltage)?;
> @@ -166,12 +165,11 @@ pub fn devm_enable_optional(dev: &Device<Bound>, name: &CStr) -> Result {
> ///
> /// ```
> /// # use kernel::prelude::*;
> -/// # use kernel::c_str;
> /// # use kernel::device::Device;
> /// # use kernel::regulator::{Voltage, Regulator, Enabled};
> /// fn enable(dev: &Device) -> Result {
> /// // Obtain a reference to a (fictitious) regulator and enable it.
> -/// let regulator: Regulator<Enabled> = Regulator::<Enabled>::get(dev, c_str!("vcc"))?;
> +/// let regulator: Regulator<Enabled> = Regulator::<Enabled>::get(dev, c"vcc")?;
> ///
> /// // Dropping an enabled regulator will disable it. The refcount will be
> /// // decremented.
> @@ -193,13 +191,12 @@ pub fn devm_enable_optional(dev: &Device<Bound>, name: &CStr) -> Result {
> ///
> /// ```
> /// # use kernel::prelude::*;
> -/// # use kernel::c_str;
> /// # use kernel::device::{Bound, Device};
> /// # use kernel::regulator;
> /// fn enable(dev: &Device<Bound>) -> Result {
> /// // Obtain a reference to a (fictitious) regulator and enable it. This
> /// // call only returns whether the operation succeeded.
> -/// regulator::devm_enable(dev, c_str!("vcc"))?;
> +/// regulator::devm_enable(dev, c"vcc")?;
> ///
> /// // The regulator will be disabled and put when `dev` is unbound.
> /// Ok(())
>
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-cstr-regulator-dc3f6d3fc384
>
> Best regards,
> --
> Tamir Duberstein <tamird@gmail.com>
>
>
Reviewed-by: Daniel Almeida <Daniel.almeida@collabora.com>
next prev parent reply other threads:[~2025-12-22 14:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 12:15 Tamir Duberstein
2025-12-22 14:35 ` Daniel Almeida [this message]
2025-12-22 20:04 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1B3A437A-5A9E-4109-A202-CD3172596929@collabora.com \
--to=daniel.almeida@collabora.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@gmail.com \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®