[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFrh4hUrw65SurJpZh=oqq31E1FsJOpV8i30uqceAD2bfg@mail.gmail.com>
Date: Tue, 20 Aug 2024 11:34:02 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>,
Anup Patel <anup@...infault.org>, Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org
Subject: Re: [PATCH 4/4] cpuidle: dt_idle_genpd: Simplify with scoped for each
OF child loop
On Fri, 16 Aug 2024 at 17:09, Krzysztof Kozlowski
<krzysztof.kozlowski@...aro.org> wrote:
>
> 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@...aro.org>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/cpuidle/dt_idle_genpd.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/cpuidle/dt_idle_genpd.c b/drivers/cpuidle/dt_idle_genpd.c
> index 1af63c189039..203e9b754aea 100644
> --- a/drivers/cpuidle/dt_idle_genpd.c
> +++ b/drivers/cpuidle/dt_idle_genpd.c
> @@ -130,11 +130,10 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
>
> int dt_idle_pd_init_topology(struct device_node *np)
> {
> - struct device_node *node;
> struct of_phandle_args child, parent;
> int ret;
>
> - for_each_child_of_node(np, node) {
> + for_each_child_of_node_scoped(np, node) {
> if (of_parse_phandle_with_args(node, "power-domains",
> "#power-domain-cells", 0, &parent))
> continue;
> @@ -143,10 +142,8 @@ int dt_idle_pd_init_topology(struct device_node *np)
> child.args_count = 0;
> ret = of_genpd_add_subdomain(&parent, &child);
> of_node_put(parent.np);
> - if (ret) {
> - of_node_put(node);
> + if (ret)
> return ret;
> - }
> }
>
> return 0;
> @@ -154,11 +151,10 @@ int dt_idle_pd_init_topology(struct device_node *np)
>
> int dt_idle_pd_remove_topology(struct device_node *np)
> {
> - struct device_node *node;
> struct of_phandle_args child, parent;
> int ret;
>
> - for_each_child_of_node(np, node) {
> + for_each_child_of_node_scoped(np, node) {
> if (of_parse_phandle_with_args(node, "power-domains",
> "#power-domain-cells", 0, &parent))
> continue;
> @@ -167,10 +163,8 @@ int dt_idle_pd_remove_topology(struct device_node *np)
> child.args_count = 0;
> ret = of_genpd_remove_subdomain(&parent, &child);
> of_node_put(parent.np);
> - if (ret) {
> - of_node_put(node);
> + if (ret)
> return ret;
> - }
> }
>
> return 0;
> --
> 2.43.0
>
Powered by blists - more mailing lists