summaryrefslogtreecommitdiff
path: root/drivers/cpuidle/dt_idle_genpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpuidle/dt_idle_genpd.c')
-rw-r--r--drivers/cpuidle/dt_idle_genpd.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/cpuidle/dt_idle_genpd.c b/drivers/cpuidle/dt_idle_genpd.c
index b37165514d4e..203e9b754aea 100644
--- a/drivers/cpuidle/dt_idle_genpd.c
+++ b/drivers/cpuidle/dt_idle_genpd.c
@@ -130,11 +130,10 @@ out:
int dt_idle_pd_init_topology(struct device_node *np)
{
- struct device_node *node;
struct of_phandle_args child, parent;
int ret;
- for_each_child_of_node(np, node) {
+ for_each_child_of_node_scoped(np, node) {
if (of_parse_phandle_with_args(node, "power-domains",
"#power-domain-cells", 0, &parent))
continue;
@@ -143,10 +142,29 @@ int dt_idle_pd_init_topology(struct device_node *np)
child.args_count = 0;
ret = of_genpd_add_subdomain(&parent, &child);
of_node_put(parent.np);
- if (ret) {
- of_node_put(node);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+int dt_idle_pd_remove_topology(struct device_node *np)
+{
+ struct of_phandle_args child, parent;
+ int ret;
+
+ for_each_child_of_node_scoped(np, node) {
+ if (of_parse_phandle_with_args(node, "power-domains",
+ "#power-domain-cells", 0, &parent))
+ continue;
+
+ child.np = node;
+ child.args_count = 0;
+ ret = of_genpd_remove_subdomain(&parent, &child);
+ of_node_put(parent.np);
+ if (ret)
return ret;
- }
}
return 0;