Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1518619 > unrolled thread
| Started by | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| First post | 2016-11-10 02:20 +0100 |
| Last post | 2016-11-10 06:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH V3 9/9] PM / OPP: Don't assume platform doesn't have regulators Stephen Boyd <sboyd@codeaurora.org> - 2016-11-10 02:20 +0100
[PATCH V4 9/9] PM / OPP: Don't assume platform doesn't have regulators Viresh Kumar <viresh.kumar@linaro.org> - 2016-11-10 06:20 +0100
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-11-10 02:20 +0100 |
| Subject | Re: [PATCH V3 9/9] PM / OPP: Don't assume platform doesn't have regulators |
| Message-ID | <sBMc2-74a-17@gated-at.bofh.it> |
On 10/26, Viresh Kumar wrote:
> If the regulators aren't set explicitly by the platform, the OPP core
> assumes that the platform doesn't have any regulator and uses the
> clk-only callback.
>
> If the platform failed to register a regulator with the core, then this
> can turn out to be a dangerous assumption as the OPP core will try to
> change clk without changing regulators.
>
> Handle that properly by making sure that the DT didn't had any entries
s/had/have/
> for supply voltages as well.
>
> diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
> index 3298fac01bb0..34cd48dfe89e 100644
> --- a/drivers/base/power/opp/core.c
> +++ b/drivers/base/power/opp/core.c
> @@ -734,7 +734,17 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
>
> /* Only frequency scaling */
> if (!regulators) {
> - rcu_read_unlock();
> + /*
> + * DT contained supply ratings? Consider platform failed to set
> + * regulators.
> + */
> + if (unlikely(opp->supplies[0].u_volt)) {
> + rcu_read_unlock();
> + dev_err(dev, "%s: Regulator not registered with OPP core\n",
> + __func__);
> + return -EINVAL;
> + }
> +
Don't we need an rcu_read_unlock() here as well?
> return _generic_set_opp_clk_only(dev, clk, old_freq, freq);
> }
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-11-10 06:20 +0100 |
| Subject | [PATCH V4 9/9] PM / OPP: Don't assume platform doesn't have regulators |
| Message-ID | <sBPWi-17h-7@gated-at.bofh.it> |
| In reply to | #1518619 |
If the regulators aren't set explicitly by the platform, the OPP core
assumes that the platform doesn't have any regulator and uses the
clk-only callback.
If the platform failed to register a regulator with the core, then this
can turn out to be a dangerous assumption as the OPP core will try to
change clk without changing regulators.
Handle that properly by making sure that the DT didn't have any entries
for supply voltages as well.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V4:
- s/had/have
- fix missing rcu_read_unlock()
drivers/base/power/opp/core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 3298fac01bb0..cb33f8b2b56d 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -734,7 +734,20 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
/* Only frequency scaling */
if (!regulators) {
+ unsigned long u_volt = opp->supplies[0].u_volt;
+
rcu_read_unlock();
+
+ /*
+ * DT contained supply ratings? Consider platform failed to set
+ * regulators.
+ */
+ if (unlikely(u_volt)) {
+ dev_err(dev, "%s: Regulator not registered with OPP core\n",
+ __func__);
+ return -EINVAL;
+ }
+
return _generic_set_opp_clk_only(dev, clk, old_freq, freq);
}
--
2.7.1.410.g6faf27b
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web