Skip to content

Commit f253f6d

Browse files
Zhang Zekunstorulf
authored andcommitted
pmdomain: qcom-cpr: Use helper function for_each_available_child_of_node()
for_each_available_child_of_node() can help to iterate through the device_node, and we don't need to use while loop. Besides, the purpose of the while loop is to find a device_node which fits the condition "child_req_np == ref_np", we can just read the property of "child_np" directly in for_each_available_child_of_node(). No functional change with such conversion. Signed-off-by: Zhang Zekun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 9e5eb74 commit f253f6d

File tree

1 file changed

+6
-6
lines changed
  • drivers/pmdomain/qcom

1 file changed

+6
-6
lines changed

drivers/pmdomain/qcom/cpr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,14 +1054,14 @@ static unsigned long cpr_get_opp_hz_for_req(struct dev_pm_opp *ref,
10541054
if (!ref_np)
10551055
goto out_ref;
10561056

1057-
do {
1057+
for_each_available_child_of_node(desc_np, child_np) {
10581058
of_node_put(child_req_np);
1059-
child_np = of_get_next_available_child(desc_np, child_np);
10601059
child_req_np = of_parse_phandle(child_np, "required-opps", 0);
1061-
} while (child_np && child_req_np != ref_np);
1062-
1063-
if (child_np && child_req_np == ref_np)
1064-
of_property_read_u64(child_np, "opp-hz", &rate);
1060+
if (child_req_np == ref_np) {
1061+
of_property_read_u64(child_np, "opp-hz", &rate);
1062+
break;
1063+
}
1064+
}
10651065

10661066
of_node_put(child_req_np);
10671067
of_node_put(child_np);

0 commit comments

Comments
 (0)