Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1320386 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2016-01-28 09:30 +0100 |
| Last post | 2016-02-09 05:30 +0100 |
| Articles | 4 — 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.
[PATCH V2 15/16] cpufreq: dt: drop references to DT node Viresh Kumar <viresh.kumar@linaro.org> - 2016-01-28 09:30 +0100
Re: [PATCH V2 15/16] cpufreq: dt: drop references to DT node Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-02 07:20 +0100
Re: [PATCH V2 15/16] cpufreq: dt: drop references to DT node Stephen Boyd <sboyd@codeaurora.org> - 2016-02-09 00:00 +0100
Re: [PATCH V2 15/16] cpufreq: dt: drop references to DT node Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-09 05:30 +0100
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-01-28 09:30 +0100 |
| Subject | [PATCH V2 15/16] cpufreq: dt: drop references to DT node |
| Message-ID | <qVQ7M-FX-9@gated-at.bofh.it> |
We don't need to get reference to DT node now, lets drop it.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
---
drivers/cpufreq/cpufreq-dt.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 13338365f24e..5ea41518df63 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -33,7 +33,6 @@ struct private_data {
struct device *cpu_dev;
struct regulator *cpu_reg;
struct thermal_cooling_device *cdev;
- unsigned int voltage_tolerance; /* in percentage */
const char *reg_name;
};
@@ -166,7 +165,6 @@ static int allocate_resources(int cpu, struct device **cdev,
static int cpufreq_init(struct cpufreq_policy *policy)
{
struct cpufreq_frequency_table *freq_table;
- struct device_node *np;
struct private_data *priv;
struct device *cpu_dev;
struct regulator *cpu_reg;
@@ -183,13 +181,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
return ret;
}
- np = of_node_get(cpu_dev->of_node);
- if (!np) {
- dev_err(cpu_dev, "failed to find cpu%d node\n", policy->cpu);
- ret = -ENOENT;
- goto out_put_reg_clk;
- }
-
/* Get OPP-sharing information from "operating-points-v2" bindings */
ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, policy->cpus);
if (ret) {
@@ -200,7 +191,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
if (ret == -ENOENT)
opp_v1 = true;
else
- goto out_node_put;
+ goto out_put_reg_clk;
}
/*
@@ -210,7 +201,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
name = find_supply_name(cpu_dev);
if (IS_ERR(name)) {
ret = PTR_ERR(name);
- goto out_node_put;
+ goto out_put_reg_clk;
}
if (name) {
@@ -218,7 +209,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
if (ret) {
dev_err(cpu_dev, "Failed to set regulator for cpu%d: %d\n",
policy->cpu, ret);
- goto out_node_put;
+ goto out_put_reg_clk;
}
}
@@ -268,7 +259,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
}
priv->reg_name = name;
- of_property_read_u32(np, "voltage-tolerance", &priv->voltage_tolerance);
ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
if (ret) {
@@ -310,8 +300,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = transition_latency;
- of_node_put(np);
-
return 0;
out_free_cpufreq_table:
@@ -322,8 +310,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
dev_pm_opp_of_cpumask_remove_table(policy->cpus);
if (name)
dev_pm_opp_put_regulator(cpu_dev);
-out_node_put:
- of_node_put(np);
out_put_reg_clk:
clk_put(cpu_clk);
if (!IS_ERR(cpu_reg))
--
2.7.0.79.gdc08a19
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-02-02 07:20 +0100 |
| Message-ID | <qXCtH-6Fa-1@gated-at.bofh.it> |
| In reply to | #1320386 |
On 28-01-16, 13:50, Viresh Kumar wrote:
> We don't need to get reference to DT node now, lets drop it.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
And because of changes in 11/16, this got updated as well:
-------------------------8<-------------------------
From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Tue, 8 Sep 2015 17:34:26 +0530
Subject: [PATCH 08/20] cpufreq: dt: No need to fetch voltage-tolerance
Its already done by core and we don't need to get it anymore. And so,
we don't need to get of node in cpufreq_init() anymore, move that to
find_supply_name() instead.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq-dt.c | 48 ++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 35c5ec3b333c..3c43fda48bdf 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -33,7 +33,6 @@ struct private_data {
struct device *cpu_dev;
struct regulator *cpu_reg;
struct thermal_cooling_device *cdev;
- unsigned int voltage_tolerance; /* in percentage */
const char *reg_name;
};
@@ -55,24 +54,38 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
* An earlier version of opp-v1 bindings used to name the regulator
* "cpu0-supply", we still need to handle that for backwards compatibility.
*/
-static const char *find_supply_name(struct device *dev, struct device_node *np)
+static const char *find_supply_name(struct device *dev)
{
+ struct device_node *np;
struct property *pp;
int cpu = dev->id;
+ const char *name = NULL;
+
+ np = of_node_get(dev->of_node);
+ if (!np) {
+ dev_err(dev, "failed to find cpu%d node\n", cpu);
+ return ERR_PTR(-ENOENT);
+ }
/* Try "cpu0" for older DTs */
if (!cpu) {
pp = of_find_property(np, "cpu0-supply", NULL);
- if (pp)
- return "cpu0";
+ if (pp) {
+ name = "cpu0";
+ goto node_put;
+ }
}
pp = of_find_property(np, "cpu-supply", NULL);
- if (pp)
- return "cpu";
+ if (pp) {
+ name = "cpu";
+ goto node_put;
+ }
dev_dbg(dev, "no regulator for cpu%d\n", cpu);
- return NULL;
+node_put:
+ of_node_put(np);
+ return name;
}
static int allocate_resources(int cpu, struct device **cdev,
@@ -147,7 +160,6 @@ static int allocate_resources(int cpu, struct device **cdev,
static int cpufreq_init(struct cpufreq_policy *policy)
{
struct cpufreq_frequency_table *freq_table;
- struct device_node *np;
struct private_data *priv;
struct device *cpu_dev;
struct regulator *cpu_reg;
@@ -164,13 +176,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
return ret;
}
- np = of_node_get(cpu_dev->of_node);
- if (!np) {
- dev_err(cpu_dev, "failed to find cpu%d node\n", policy->cpu);
- ret = -ENOENT;
- goto out_put_reg_clk;
- }
-
/* Get OPP-sharing information from "operating-points-v2" bindings */
ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, policy->cpus);
if (ret) {
@@ -181,17 +186,17 @@ static int cpufreq_init(struct cpufreq_policy *policy)
if (ret == -ENOENT)
opp_v1 = true;
else
- goto out_node_put;
+ goto out_put_reg_clk;
}
/*
* OPP layer will be taking care of regulators now, but it needs to know
* the name of the regulator first.
*/
- name = find_supply_name(cpu_dev, np);
+ name = find_supply_name(cpu_dev);
if (IS_ERR(name)) {
ret = PTR_ERR(name);
- goto out_node_put;
+ goto out_put_reg_clk;
}
if (name) {
@@ -199,7 +204,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
if (ret) {
dev_err(cpu_dev, "Failed to set regulator for cpu%d: %d\n",
policy->cpu, ret);
- goto out_node_put;
+ goto out_put_reg_clk;
}
}
@@ -249,7 +254,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
}
priv->reg_name = name;
- of_property_read_u32(np, "voltage-tolerance", &priv->voltage_tolerance);
ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
if (ret) {
@@ -291,8 +295,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = transition_latency;
- of_node_put(np);
-
return 0;
out_free_cpufreq_table:
@@ -303,8 +305,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
dev_pm_opp_of_cpumask_remove_table(policy->cpus);
if (name)
dev_pm_opp_put_regulator(cpu_dev);
-out_node_put:
- of_node_put(np);
out_put_reg_clk:
clk_put(cpu_clk);
if (!IS_ERR(cpu_reg))
[toc] | [prev] | [next] | [standalone]
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-02-09 00:00 +0100 |
| Message-ID | <r02WL-3dj-19@gated-at.bofh.it> |
| In reply to | #1323814 |
On 02/02, Viresh Kumar wrote: > From: Viresh Kumar <viresh.kumar@linaro.org> > Date: Tue, 8 Sep 2015 17:34:26 +0530 > Subject: [PATCH 08/20] cpufreq: dt: No need to fetch voltage-tolerance > > Its already done by core and we don't need to get it anymore. And so, > we don't need to get of node in cpufreq_init() anymore, move that to > find_supply_name() instead. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-02-09 05:30 +0100 |
| Message-ID | <r0867-7bw-21@gated-at.bofh.it> |
| In reply to | #1323814 |
On 02-02-16, 11:41, Viresh Kumar wrote:
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> +static const char *find_supply_name(struct device *dev)
> {
> + struct device_node *np;
> struct property *pp;
> int cpu = dev->id;
> + const char *name = NULL;
> +
> + np = of_node_get(dev->of_node);
> + if (!np) {
> + dev_err(dev, "failed to find cpu%d node\n", cpu);
> + return ERR_PTR(-ENOENT);
> + }
I have updated that as:
+ np = of_node_get(dev->of_node);
+
+ /* This must be valid for sure */
+ if (WARN_ON(!np))
+ return NULL;
so that we don't have to check return value of find_supply_name() for errors, as
you pointed out in the other patch.
Will keep your RBY tag :)
--
viresh
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web