[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44k7h2wzksrp4eghvdim5kiq5tsul3p7yhy44d3eii7hyvivch@xx3x762acknd>
Date: Thu, 23 Oct 2025 17:02:35 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Tamir Duberstein <tamird@...nel.org>
Cc: Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
Stephen Boyd <sboyd@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, linux-pm@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: opp: simplify callers of `to_c_str_array`
On 22-10-25, 07:22, Tamir Duberstein wrote:
> I believe the `{clk,regulator}_names` vector bindings remain alive for
> the whole scope, even if they are shadowed. See
> https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=800b334c514c2024d7b5e47fc54c1f2d.
I tried to print the name of the regulator and clk in the C code:
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index d67d392e16d4..89b65fe07b99 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2565,6 +2565,8 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config)
goto err;
}
+ pr_info("%s: %d: %s: %s\n", __func__, __LINE__, config->clk_names[0], config->regulator_names[0]);
and I get this:
[ 2.358437] core: dev_pm_opp_set_config: 2568: �<��y����<��y���x��: �<��y����<��y���x��
With following diff applied over your patch, it works again:
diff --git a/rust/kernel/opp.rs b/rust/kernel/opp.rs
index 743080e14292..02cb754c4abd 100644
--- a/rust/kernel/opp.rs
+++ b/rust/kernel/opp.rs
@@ -444,13 +444,13 @@ pub fn set_supported_hw(mut self, hw: KVec<u32>) -> Result<Self> {
/// The returned [`ConfigToken`] will remove the configuration when dropped.
pub fn set(self, dev: &Device) -> Result<ConfigToken> {
let clk_names = self.clk_names.as_deref().map(to_c_str_array).transpose()?;
- let clk_names = clk_names.map_or(ptr::null(), |c| c.as_ptr());
+ let clk_names = clk_names.as_ref().map_or(ptr::null(), |c| c.as_ptr());
let regulator_names = self
.regulator_names
.as_deref()
.map(to_c_str_array)
.transpose()?;
- let regulator_names = regulator_names.map_or(ptr::null(), |c| c.as_ptr());
+ let regulator_names = regulator_names.as_ref().map_or(ptr::null(), |c| c.as_ptr());
let prop_name = self
.prop_name
and I get:
[ 2.460149] core: dev_pm_opp_set_config: 2568: dummy_clk: dummy_reg
--
viresh
Powered by blists - more mailing lists