diff mbox series

[05/13] cpuidle: dt: Support hierarchical CPU idle states

Message ID 20191010113937.15962-6-ulf.hansson@linaro.org
State Accepted
Commit 778f173eb4528a6b48ff6a8600515899de75333c
Headers show
Series None | expand

Commit Message

Ulf Hansson Oct. 10, 2019, 11:39 a.m. UTC
From: Lina Iyer <lina.iyer@linaro.org>


Currently CPU's idle states are represented using the flattened model.
Let's add support for the hierarchical layout, via converting to use
of_get_cpu_state_node().

Suggested-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Lina Iyer <lina.iyer@linaro.org>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Co-developed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

---
 drivers/cpuidle/dt_idle_states.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

-- 
2.17.1

Comments

Sudeep Holla Oct. 24, 2019, 3:30 p.m. UTC | #1
On Thu, Oct 10, 2019 at 01:39:29PM +0200, Ulf Hansson wrote:
> From: Lina Iyer <lina.iyer@linaro.org>

> 

> Currently CPU's idle states are represented using the flattened model.

> Let's add support for the hierarchical layout, via converting to use

> of_get_cpu_state_node().

> 

> Suggested-by: Sudeep Holla <sudeep.holla@arm.com>


Looks simpler now, thanks.

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>


--
Regards,
Sudeep
diff mbox series

Patch

diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
index d06d21a9525d..252f2a9686a6 100644
--- a/drivers/cpuidle/dt_idle_states.c
+++ b/drivers/cpuidle/dt_idle_states.c
@@ -111,8 +111,7 @@  static bool idle_state_valid(struct device_node *state_node, unsigned int idx,
 	for (cpu = cpumask_next(cpumask_first(cpumask), cpumask);
 	     cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpumask)) {
 		cpu_node = of_cpu_device_node_get(cpu);
-		curr_state_node = of_parse_phandle(cpu_node, "cpu-idle-states",
-						   idx);
+		curr_state_node = of_get_cpu_state_node(cpu_node, idx);
 		if (state_node != curr_state_node)
 			valid = false;
 
@@ -170,7 +169,7 @@  int dt_init_idle_driver(struct cpuidle_driver *drv,
 	cpu_node = of_cpu_device_node_get(cpumask_first(cpumask));
 
 	for (i = 0; ; i++) {
-		state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i);
+		state_node = of_get_cpu_state_node(cpu_node, i);
 		if (!state_node)
 			break;