Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpuidle: dt_idle_genpd: Add helper function to remove genpd topology

Genpd parent and child domain topology created using dt_idle_pd_init_topology()
needs to be removed during error cases.

Add new helper function dt_idle_pd_remove_topology() for same.

Cc: stable@vger.kernel.org
Reviewed-by: Ulf Hanssson <ulf.hansson@linaro.org>
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Maulik Shah and committed by
Ulf Hansson
9a8fa00d 52a93d39

+31
+24
drivers/cpuidle/dt_idle_genpd.c
··· 152 152 return 0; 153 153 } 154 154 155 + int dt_idle_pd_remove_topology(struct device_node *np) 156 + { 157 + struct device_node *node; 158 + struct of_phandle_args child, parent; 159 + int ret; 160 + 161 + for_each_child_of_node(np, node) { 162 + if (of_parse_phandle_with_args(node, "power-domains", 163 + "#power-domain-cells", 0, &parent)) 164 + continue; 165 + 166 + child.np = node; 167 + child.args_count = 0; 168 + ret = of_genpd_remove_subdomain(&parent, &child); 169 + of_node_put(parent.np); 170 + if (ret) { 171 + of_node_put(node); 172 + return ret; 173 + } 174 + } 175 + 176 + return 0; 177 + } 178 + 155 179 struct device *dt_idle_attach_cpu(int cpu, const char *name) 156 180 { 157 181 struct device *dev;
+7
drivers/cpuidle/dt_idle_genpd.h
··· 14 14 15 15 int dt_idle_pd_init_topology(struct device_node *np); 16 16 17 + int dt_idle_pd_remove_topology(struct device_node *np); 18 + 17 19 struct device *dt_idle_attach_cpu(int cpu, const char *name); 18 20 19 21 void dt_idle_detach_cpu(struct device *dev); ··· 34 32 } 35 33 36 34 static inline int dt_idle_pd_init_topology(struct device_node *np) 35 + { 36 + return 0; 37 + } 38 + 39 + static inline int dt_idle_pd_remove_topology(struct device_node *np) 37 40 { 38 41 return 0; 39 42 }