From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Heiko Stuebner <heiko@sntech.de>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>, <linux-pm@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-rockchip@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <imx@lists.linux.dev>,
<linux-arm-msm@vger.kernel.org>,
<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 01/10] pmdomain: rockchip: Simplify with scoped for each OF child loop
Date: Tue, 27 Aug 2024 10:53:43 +0100 [thread overview]
Message-ID: <20240827105343.00003a72@Huawei.com> (raw)
In-Reply-To: <20240823-cleanup-h-guard-pm-domain-v1-1-8320722eaf39@linaro.org>
On Fri, 23 Aug 2024 14:51:05 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> Use scoped for_each_available_child_of_node_scoped() and
> 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>
Ripe for some dev_err_probe() usage that will make this even nicer
as a cleanup.
Looks good as it stands
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/pmdomain/rockchip/pm-domains.c | 20 ++++++--------------
> 1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index 64b4d7120d83..5679ad336a11 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
> @@ -804,11 +804,10 @@ static void rockchip_configure_pd_cnt(struct rockchip_pmu *pmu,
> static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> struct device_node *parent)
> {
> - struct device_node *np;
> struct generic_pm_domain *child_domain, *parent_domain;
> int error;
>
> - for_each_child_of_node(parent, np) {
> + for_each_child_of_node_scoped(parent, np) {
> u32 idx;
>
> error = of_property_read_u32(parent, "reg", &idx);
> @@ -816,7 +815,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> dev_err(pmu->dev,
> "%pOFn: failed to retrieve domain id (reg): %d\n",
> parent, error);
> - goto err_out;
> + return error;
> }
> parent_domain = pmu->genpd_data.domains[idx];
>
> @@ -824,7 +823,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> if (error) {
> dev_err(pmu->dev, "failed to handle node %pOFn: %d\n",
> np, error);
> - goto err_out;
> + return error;
> }
>
> error = of_property_read_u32(np, "reg", &idx);
> @@ -832,7 +831,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> dev_err(pmu->dev,
> "%pOFn: failed to retrieve domain id (reg): %d\n",
> np, error);
> - goto err_out;
> + return error;
> }
> child_domain = pmu->genpd_data.domains[idx];
>
> @@ -840,7 +839,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> if (error) {
> dev_err(pmu->dev, "%s failed to add subdomain %s: %d\n",
> parent_domain->name, child_domain->name, error);
> - goto err_out;
> + return error;
> } else {
> dev_dbg(pmu->dev, "%s add subdomain: %s\n",
> parent_domain->name, child_domain->name);
> @@ -850,17 +849,12 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> }
>
> return 0;
> -
> -err_out:
> - of_node_put(np);
> - return error;
> }
>
> static int rockchip_pm_domain_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct device_node *np = dev->of_node;
> - struct device_node *node;
> struct device *parent;
> struct rockchip_pmu *pmu;
> const struct rockchip_pmu_info *pmu_info;
> @@ -918,12 +912,11 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
> */
> mutex_lock(&dmc_pmu_mutex);
>
> - for_each_available_child_of_node(np, node) {
> + for_each_available_child_of_node_scoped(np, node) {
> error = rockchip_pm_add_one_domain(pmu, node);
> if (error) {
> dev_err(dev, "failed to handle node %pOFn: %d\n",
> node, error);
> - of_node_put(node);
> goto err_out;
> }
>
> @@ -931,7 +924,6 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
> if (error < 0) {
> dev_err(dev, "failed to handle subdomain node %pOFn: %d\n",
> node, error);
> - of_node_put(node);
> goto err_out;
> }
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Heiko Stuebner <heiko@sntech.de>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>, <linux-pm@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-rockchip@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <imx@lists.linux.dev>,
<linux-arm-msm@vger.kernel.org>,
<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 01/10] pmdomain: rockchip: Simplify with scoped for each OF child loop
Date: Tue, 27 Aug 2024 10:53:43 +0100 [thread overview]
Message-ID: <20240827105343.00003a72@Huawei.com> (raw)
In-Reply-To: <20240823-cleanup-h-guard-pm-domain-v1-1-8320722eaf39@linaro.org>
On Fri, 23 Aug 2024 14:51:05 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> Use scoped for_each_available_child_of_node_scoped() and
> 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>
Ripe for some dev_err_probe() usage that will make this even nicer
as a cleanup.
Looks good as it stands
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/pmdomain/rockchip/pm-domains.c | 20 ++++++--------------
> 1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index 64b4d7120d83..5679ad336a11 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
> @@ -804,11 +804,10 @@ static void rockchip_configure_pd_cnt(struct rockchip_pmu *pmu,
> static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> struct device_node *parent)
> {
> - struct device_node *np;
> struct generic_pm_domain *child_domain, *parent_domain;
> int error;
>
> - for_each_child_of_node(parent, np) {
> + for_each_child_of_node_scoped(parent, np) {
> u32 idx;
>
> error = of_property_read_u32(parent, "reg", &idx);
> @@ -816,7 +815,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> dev_err(pmu->dev,
> "%pOFn: failed to retrieve domain id (reg): %d\n",
> parent, error);
> - goto err_out;
> + return error;
> }
> parent_domain = pmu->genpd_data.domains[idx];
>
> @@ -824,7 +823,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> if (error) {
> dev_err(pmu->dev, "failed to handle node %pOFn: %d\n",
> np, error);
> - goto err_out;
> + return error;
> }
>
> error = of_property_read_u32(np, "reg", &idx);
> @@ -832,7 +831,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> dev_err(pmu->dev,
> "%pOFn: failed to retrieve domain id (reg): %d\n",
> np, error);
> - goto err_out;
> + return error;
> }
> child_domain = pmu->genpd_data.domains[idx];
>
> @@ -840,7 +839,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> if (error) {
> dev_err(pmu->dev, "%s failed to add subdomain %s: %d\n",
> parent_domain->name, child_domain->name, error);
> - goto err_out;
> + return error;
> } else {
> dev_dbg(pmu->dev, "%s add subdomain: %s\n",
> parent_domain->name, child_domain->name);
> @@ -850,17 +849,12 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
> }
>
> return 0;
> -
> -err_out:
> - of_node_put(np);
> - return error;
> }
>
> static int rockchip_pm_domain_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct device_node *np = dev->of_node;
> - struct device_node *node;
> struct device *parent;
> struct rockchip_pmu *pmu;
> const struct rockchip_pmu_info *pmu_info;
> @@ -918,12 +912,11 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
> */
> mutex_lock(&dmc_pmu_mutex);
>
> - for_each_available_child_of_node(np, node) {
> + for_each_available_child_of_node_scoped(np, node) {
> error = rockchip_pm_add_one_domain(pmu, node);
> if (error) {
> dev_err(dev, "failed to handle node %pOFn: %d\n",
> node, error);
> - of_node_put(node);
> goto err_out;
> }
>
> @@ -931,7 +924,6 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
> if (error < 0) {
> dev_err(dev, "failed to handle subdomain node %pOFn: %d\n",
> node, error);
> - of_node_put(node);
> goto err_out;
> }
> }
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2024-08-27 9:53 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 12:51 [PATCH 00/10] pmdomain: Simplify with cleanup.h Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-23 12:51 ` [PATCH 01/10] pmdomain: rockchip: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 9:53 ` Jonathan Cameron [this message]
2024-08-27 9:53 ` Jonathan Cameron
2024-08-23 12:51 ` [PATCH 02/10] pmdomain: rockchip: Simplify locking with guard() Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 9:59 ` Jonathan Cameron
2024-08-27 9:59 ` Jonathan Cameron
2024-08-27 10:30 ` Krzysztof Kozlowski
2024-08-27 10:30 ` Krzysztof Kozlowski
2024-08-23 12:51 ` [PATCH 03/10] pmdomain: imx: gpc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-23 12:51 ` [PATCH 04/10] pmdomain: imx: gpcv2: " Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-23 12:51 ` [PATCH 05/10] pmdomain: qcom: cpr: Simplify with dev_err_probe() Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 9:45 ` Konrad Dybcio
2024-08-27 9:45 ` Konrad Dybcio
2024-08-23 12:51 ` [PATCH 06/10] pmdomain: qcom: cpr: Simplify locking with guard() Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 9:47 ` Konrad Dybcio
2024-08-27 9:47 ` Konrad Dybcio
2024-08-23 12:51 ` [PATCH 07/10] pmdomain: qcom: rpmhpd: " Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 9:48 ` Konrad Dybcio
2024-08-27 9:48 ` Konrad Dybcio
2024-08-23 12:51 ` [PATCH 08/10] pmdomain: qcom: rpmpd: " Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 9:49 ` Konrad Dybcio
2024-08-27 9:49 ` Konrad Dybcio
2024-08-23 12:51 ` [PATCH 09/10] pmdomain: renesas: rcar-gen4-sysc: Use scoped device node handling to simplify error paths Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 7:48 ` Geert Uytterhoeven
2024-08-27 7:48 ` Geert Uytterhoeven
2024-08-27 9:33 ` Krzysztof Kozlowski
2024-08-27 9:33 ` Krzysztof Kozlowski
2024-08-27 9:39 ` Krzysztof Kozlowski
2024-08-27 9:39 ` Krzysztof Kozlowski
2024-08-27 10:55 ` Geert Uytterhoeven
2024-08-27 10:55 ` Geert Uytterhoeven
2024-08-27 11:12 ` Krzysztof Kozlowski
2024-08-27 11:12 ` Krzysztof Kozlowski
2024-11-27 13:14 ` Geert Uytterhoeven
2024-11-27 13:14 ` Geert Uytterhoeven
2024-08-23 12:51 ` [PATCH 10/10] pmdomain: renesas: rcar-sysc: " Krzysztof Kozlowski
2024-08-23 12:51 ` Krzysztof Kozlowski
2024-08-27 7:55 ` Geert Uytterhoeven
2024-08-27 7:55 ` Geert Uytterhoeven
2024-09-13 12:01 ` [PATCH 00/10] pmdomain: Simplify with cleanup.h Ulf Hansson
2024-09-13 12:01 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240827105343.00003a72@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=andersson@kernel.org \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=heiko@sntech.de \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=konradybcio@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=magnus.damm@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.