[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1374069984-20567-13-git-send-email-Sudeep.KarkadaNagesha@arm.com>
Date: Wed, 17 Jul 2013 15:06:21 +0100
From: Sudeep.KarkadaNagesha@....com
To: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
cpufreq@...r.kernel.org, linux-pm@...r.kernel.org,
devicetree-discuss@...ts.ozlabs.org
Cc: Russell King <linux@....linux.org.uk>,
Shawn Guo <shawn.guo@...aro.org>,
Gregory Clement <gregory.clement@...e-electrons.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
"Rafael J. Wysocki" <rjw@...k.pl>,
Grant Likely <grant.likely@...aro.org>,
Rob Herring <rob.herring@...xeda.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Olof Johansson <olof@...om.net>, Arnd Bergmann <arnd@...db.de>,
Sudeep KarkadaNagesha <sudeep.karkadanagesha@....com>
Subject: [RFC PATCH v2 12/15] cpufreq: arm_big_little: remove device tree parsing for cpu nodes
From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@....com>
Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.
This patch removes all DT parsing and uses cpu->of_node instead.
Acked-by: Viresh Kumar <viresh.kumar@...aro.org>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@....com>
---
drivers/cpufreq/arm_big_little_dt.c | 39 ++++++++++++++++---------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c
index fd9e3ea..d2648d1 100644
--- a/drivers/cpufreq/arm_big_little_dt.c
+++ b/drivers/cpufreq/arm_big_little_dt.c
@@ -34,27 +34,19 @@
/* get cpu node with valid operating-points */
static struct device_node *get_cpu_node_with_valid_op(int cpu)
{
- struct device_node *np = NULL, *parent;
- int count = 0;
+ struct device *cpu_dev = get_cpu_device(cpu);
+ struct device_node *np;
- parent = of_find_node_by_path("/cpus");
- if (!parent) {
- pr_err("failed to find OF /cpus\n");
+ if (!cpu_dev) {
+ pr_err("failed to get cpu device\n");
return NULL;
}
-
- for_each_child_of_node(parent, np) {
- if (count++ != cpu)
- continue;
- if (!of_get_property(np, "operating-points", NULL)) {
- of_node_put(np);
- np = NULL;
- }
-
- break;
+ np = of_node_get(cpu_dev->of_node);
+ if (!of_get_property(np, "operating-points", NULL)) {
+ of_node_put(np);
+ np = NULL;
}
- of_node_put(parent);
return np;
}
@@ -63,11 +55,12 @@ static int dt_init_opp_table(struct device *cpu_dev)
struct device_node *np;
int ret;
- np = get_cpu_node_with_valid_op(cpu_dev->id);
- if (!np)
- return -ENODATA;
+ np = of_node_get(cpu_dev->of_node);
+ if (!np) {
+ pr_err("failed to find cpu%d node\n", cpu_dev->id);
+ return -ENOENT;
+ }
- cpu_dev->of_node = np;
ret = of_init_opp_table(cpu_dev);
of_node_put(np);
@@ -79,9 +72,11 @@ static int dt_get_transition_latency(struct device *cpu_dev)
struct device_node *np;
u32 transition_latency = CPUFREQ_ETERNAL;
- np = get_cpu_node_with_valid_op(cpu_dev->id);
- if (!np)
+ np = of_node_get(cpu_dev->of_node);
+ if (!np) {
+ pr_info("Failed to find cpu node. Use CPUFREQ_ETERNAL transition latency\n");
return CPUFREQ_ETERNAL;
+ }
of_property_read_u32(np, "clock-latency", &transition_latency);
of_node_put(np);
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists