aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>2013-06-17 10:51:44 -0400
committerSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>2013-08-21 05:29:55 -0400
commitda0eb143dbbaf26b6f084bee81d56fc64efb5390 (patch)
tree1b6f04e08bace36682d33866bf3c3fdac5fc1baf /drivers/cpufreq
parente768f350c8c3d4253011282db771f35af37ee59a (diff)
cpufreq: arm_big_little: remove device tree parsing for cpu nodes
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@linaro.org> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/arm_big_little_dt.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c
index fd9e3ea6a480..480c0bd0468d 100644
--- a/drivers/cpufreq/arm_big_little_dt.c
+++ b/drivers/cpufreq/arm_big_little_dt.c
@@ -19,12 +19,11 @@
19 19
20#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 20#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21 21
22#include <linux/cpu.h>
23#include <linux/cpufreq.h> 22#include <linux/cpufreq.h>
24#include <linux/device.h> 23#include <linux/device.h>
25#include <linux/export.h> 24#include <linux/export.h>
26#include <linux/module.h> 25#include <linux/module.h>
27#include <linux/of.h> 26#include <linux/of_device.h>
28#include <linux/opp.h> 27#include <linux/opp.h>
29#include <linux/platform_device.h> 28#include <linux/platform_device.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
@@ -34,27 +33,13 @@
34/* get cpu node with valid operating-points */ 33/* get cpu node with valid operating-points */
35static struct device_node *get_cpu_node_with_valid_op(int cpu) 34static struct device_node *get_cpu_node_with_valid_op(int cpu)
36{ 35{
37 struct device_node *np = NULL, *parent; 36 struct device_node *np = of_cpu_device_node_get(cpu);
38 int count = 0;
39 37
40 parent = of_find_node_by_path("/cpus"); 38 if (!of_get_property(np, "operating-points", NULL)) {
41 if (!parent) { 39 of_node_put(np);
42 pr_err("failed to find OF /cpus\n"); 40 np = NULL;
43 return NULL;
44 } 41 }
45 42
46 for_each_child_of_node(parent, np) {
47 if (count++ != cpu)
48 continue;
49 if (!of_get_property(np, "operating-points", NULL)) {
50 of_node_put(np);
51 np = NULL;
52 }
53
54 break;
55 }
56
57 of_node_put(parent);
58 return np; 43 return np;
59} 44}
60 45
@@ -63,11 +48,12 @@ static int dt_init_opp_table(struct device *cpu_dev)
63 struct device_node *np; 48 struct device_node *np;
64 int ret; 49 int ret;
65 50
66 np = get_cpu_node_with_valid_op(cpu_dev->id); 51 np = of_node_get(cpu_dev->of_node);
67 if (!np) 52 if (!np) {
68 return -ENODATA; 53 pr_err("failed to find cpu%d node\n", cpu_dev->id);
54 return -ENOENT;
55 }
69 56
70 cpu_dev->of_node = np;
71 ret = of_init_opp_table(cpu_dev); 57 ret = of_init_opp_table(cpu_dev);
72 of_node_put(np); 58 of_node_put(np);
73 59
@@ -79,9 +65,11 @@ static int dt_get_transition_latency(struct device *cpu_dev)
79 struct device_node *np; 65 struct device_node *np;
80 u32 transition_latency = CPUFREQ_ETERNAL; 66 u32 transition_latency = CPUFREQ_ETERNAL;
81 67
82 np = get_cpu_node_with_valid_op(cpu_dev->id); 68 np = of_node_get(cpu_dev->of_node);
83 if (!np) 69 if (!np) {
70 pr_info("Failed to find cpu node. Use CPUFREQ_ETERNAL transition latency\n");
84 return CPUFREQ_ETERNAL; 71 return CPUFREQ_ETERNAL;
72 }
85 73
86 of_property_read_u32(np, "clock-latency", &transition_latency); 74 of_property_read_u32(np, "clock-latency", &transition_latency);
87 of_node_put(np); 75 of_node_put(np);