pmdomain: imx: gpc: Simplify with scoped for each OF child loop
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> Link: https://lore.kernel.org/r/20240823-cleanup-h-guard-pm-domain-v1-3-8320722eaf39@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
da64dae426
commit
3e4d109ee8
@ -455,7 +455,6 @@ static int imx_gpc_probe(struct platform_device *pdev)
|
|||||||
} else {
|
} else {
|
||||||
struct imx_pm_domain *domain;
|
struct imx_pm_domain *domain;
|
||||||
struct platform_device *pd_pdev;
|
struct platform_device *pd_pdev;
|
||||||
struct device_node *np;
|
|
||||||
struct clk *ipg_clk;
|
struct clk *ipg_clk;
|
||||||
unsigned int ipg_rate_mhz;
|
unsigned int ipg_rate_mhz;
|
||||||
int domain_index;
|
int domain_index;
|
||||||
@ -465,28 +464,24 @@ static int imx_gpc_probe(struct platform_device *pdev)
|
|||||||
return PTR_ERR(ipg_clk);
|
return PTR_ERR(ipg_clk);
|
||||||
ipg_rate_mhz = clk_get_rate(ipg_clk) / 1000000;
|
ipg_rate_mhz = clk_get_rate(ipg_clk) / 1000000;
|
||||||
|
|
||||||
for_each_child_of_node(pgc_node, np) {
|
for_each_child_of_node_scoped(pgc_node, np) {
|
||||||
ret = of_property_read_u32(np, "reg", &domain_index);
|
ret = of_property_read_u32(np, "reg", &domain_index);
|
||||||
if (ret) {
|
if (ret)
|
||||||
of_node_put(np);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
if (domain_index >= of_id_data->num_domains)
|
if (domain_index >= of_id_data->num_domains)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pd_pdev = platform_device_alloc("imx-pgc-power-domain",
|
pd_pdev = platform_device_alloc("imx-pgc-power-domain",
|
||||||
domain_index);
|
domain_index);
|
||||||
if (!pd_pdev) {
|
if (!pd_pdev)
|
||||||
of_node_put(np);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
ret = platform_device_add_data(pd_pdev,
|
ret = platform_device_add_data(pd_pdev,
|
||||||
&imx_gpc_domains[domain_index],
|
&imx_gpc_domains[domain_index],
|
||||||
sizeof(imx_gpc_domains[domain_index]));
|
sizeof(imx_gpc_domains[domain_index]));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
platform_device_put(pd_pdev);
|
platform_device_put(pd_pdev);
|
||||||
of_node_put(np);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
domain = pd_pdev->dev.platform_data;
|
domain = pd_pdev->dev.platform_data;
|
||||||
@ -500,7 +495,6 @@ static int imx_gpc_probe(struct platform_device *pdev)
|
|||||||
ret = platform_device_add(pd_pdev);
|
ret = platform_device_add(pd_pdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
platform_device_put(pd_pdev);
|
platform_device_put(pd_pdev);
|
||||||
of_node_put(np);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user