mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 00:20:52 -05:00
pmdomain: qcom-cpr: Use scope based of_node_put() to simplify code.
Use scope based of_node_put() to simplify the code logic, and we don't need to call of_node_put(). This will simplify the code a lot. Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> Link: https://lore.kernel.org/r/20240821034022.27394-3-zhangzekun11@huawei.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
f253f6d922
commit
181c814855
1 changed files with 12 additions and 18 deletions
|
@ -1040,36 +1040,30 @@ static unsigned int cpr_get_fuse_corner(struct dev_pm_opp *opp)
|
|||
static unsigned long cpr_get_opp_hz_for_req(struct dev_pm_opp *ref,
|
||||
struct device *cpu_dev)
|
||||
{
|
||||
u64 rate = 0;
|
||||
struct device_node *ref_np;
|
||||
struct device_node *desc_np;
|
||||
struct device_node *child_np = NULL;
|
||||
struct device_node *child_req_np = NULL;
|
||||
struct device_node *ref_np __free(device_node) = NULL;
|
||||
struct device_node *desc_np __free(device_node) =
|
||||
dev_pm_opp_of_get_opp_desc_node(cpu_dev);
|
||||
|
||||
desc_np = dev_pm_opp_of_get_opp_desc_node(cpu_dev);
|
||||
if (!desc_np)
|
||||
return 0;
|
||||
|
||||
ref_np = dev_pm_opp_get_of_node(ref);
|
||||
if (!ref_np)
|
||||
goto out_ref;
|
||||
return 0;
|
||||
|
||||
for_each_available_child_of_node_scoped(desc_np, child_np) {
|
||||
struct device_node *child_req_np __free(device_node) =
|
||||
of_parse_phandle(child_np, "required-opps", 0);
|
||||
|
||||
for_each_available_child_of_node(desc_np, child_np) {
|
||||
of_node_put(child_req_np);
|
||||
child_req_np = of_parse_phandle(child_np, "required-opps", 0);
|
||||
if (child_req_np == ref_np) {
|
||||
u64 rate;
|
||||
|
||||
of_property_read_u64(child_np, "opp-hz", &rate);
|
||||
break;
|
||||
return (unsigned long) rate;
|
||||
}
|
||||
}
|
||||
|
||||
of_node_put(child_req_np);
|
||||
of_node_put(child_np);
|
||||
of_node_put(ref_np);
|
||||
out_ref:
|
||||
of_node_put(desc_np);
|
||||
|
||||
return (unsigned long) rate;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpr_corner_init(struct cpr_drv *drv)
|
||||
|
|
Loading…
Reference in a new issue