* [PATCH] rust: regulator: replace `kernel::c_str!` with C-Strings
@ 2025-12-22 12:15 Tamir Duberstein
2025-12-22 14:35 ` Daniel Almeida
2025-12-22 20:04 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Tamir Duberstein @ 2025-12-22 12:15 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: linux-kernel, rust-for-linux, Tamir Duberstein
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: regulator: replace `kernel::c_str!` with C-Strings
2025-12-22 12:15 [PATCH] rust: regulator: replace `kernel::c_str!` with C-Strings Tamir Duberstein
@ 2025-12-22 14:35 ` Daniel Almeida
2025-12-22 20:04 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Almeida @ 2025-12-22 14:35 UTC (permalink / raw)
To: Tamir Duberstein
Cc: Liam Girdwood, Mark Brown, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, linux-kernel, rust-for-linux,
Tamir Duberstein
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rust: regulator: replace `kernel::c_str!` with C-Strings
2025-12-22 12:15 [PATCH] rust: regulator: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2025-12-22 14:35 ` Daniel Almeida
@ 2025-12-22 20:04 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-12-22 20:04 UTC (permalink / raw)
To: Liam Girdwood, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, Tamir Duberstein
Cc: linux-kernel, rust-for-linux, Tamir Duberstein
On Mon, 22 Dec 2025 13:15:58 +0100, Tamir Duberstein wrote:
> C-String literals were added in Rust 1.77. Replace instances of
> `kernel::c_str!` with C-String literals where possible.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] rust: regulator: replace `kernel::c_str!` with C-Strings
commit: b0655377aa5a410df02d89170c20141a1a5bbc28
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-22 20:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-22 12:15 [PATCH] rust: regulator: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2025-12-22 14:35 ` Daniel Almeida
2025-12-22 20:04 ` Mark Brown
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®