Skip to content

Commit ebdc840

Browse files
committed
cpuidle: dt_idle_genpd: Simplify with scoped for each OF child loop
JIRA: https://issues.redhat.com/browse/RHEL-64032 commit 157519c Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Date: Tue, 20 Aug 2024 11:30:39 +0000 Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20240816150931.142208-4-krzysztof.kozlowski@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent 91c6586 commit ebdc840

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/cpuidle/dt_idle_genpd.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,10 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
130130

131131
int dt_idle_pd_init_topology(struct device_node *np)
132132
{
133-
struct device_node *node;
134133
struct of_phandle_args child, parent;
135134
int ret;
136135

137-
for_each_child_of_node(np, node) {
136+
for_each_child_of_node_scoped(np, node) {
138137
if (of_parse_phandle_with_args(node, "power-domains",
139138
"#power-domain-cells", 0, &parent))
140139
continue;
@@ -143,22 +142,19 @@ int dt_idle_pd_init_topology(struct device_node *np)
143142
child.args_count = 0;
144143
ret = of_genpd_add_subdomain(&parent, &child);
145144
of_node_put(parent.np);
146-
if (ret) {
147-
of_node_put(node);
145+
if (ret)
148146
return ret;
149-
}
150147
}
151148

152149
return 0;
153150
}
154151

155152
int dt_idle_pd_remove_topology(struct device_node *np)
156153
{
157-
struct device_node *node;
158154
struct of_phandle_args child, parent;
159155
int ret;
160156

161-
for_each_child_of_node(np, node) {
157+
for_each_child_of_node_scoped(np, node) {
162158
if (of_parse_phandle_with_args(node, "power-domains",
163159
"#power-domain-cells", 0, &parent))
164160
continue;
@@ -167,10 +163,8 @@ int dt_idle_pd_remove_topology(struct device_node *np)
167163
child.args_count = 0;
168164
ret = of_genpd_remove_subdomain(&parent, &child);
169165
of_node_put(parent.np);
170-
if (ret) {
171-
of_node_put(node);
166+
if (ret)
172167
return ret;
173-
}
174168
}
175169

176170
return 0;

0 commit comments

Comments
 (0)