From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Cc: Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Nathan Chancellor <nathan@kernel.org>,
"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
<linux-ide@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<imx@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>,
<llvm@lists.linux.dev>
Subject: Re: [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop
Date: Mon, 5 Jan 2026 10:52:52 +0000 [thread overview]
Message-ID: <20260105105252.00003b5a@huawei.com> (raw)
In-Reply-To: <20260102125040.65256-4-krzysztof.kozlowski@oss.qualcomm.com>
On Fri, 2 Jan 2026 13:50:41 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
A whilst you are here suggestion inline to make it a bit simpler.
> ---
> drivers/ata/ahci_dwc.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ata/ahci_dwc.c b/drivers/ata/ahci_dwc.c
> index aec6d793f51a..bfd24772ee67 100644
> --- a/drivers/ata/ahci_dwc.c
> +++ b/drivers/ata/ahci_dwc.c
> @@ -260,7 +260,6 @@ static void ahci_dwc_init_timer(struct ahci_host_priv *hpriv)
> static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
> {
> struct ahci_dwc_host_priv *dpriv = hpriv->plat_data;
> - struct device_node *child;
> void __iomem *port_mmio;
> u32 port, dmacr, ts;
>
> @@ -271,14 +270,12 @@ static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
> * the HBA global reset so we can freely initialize it once until the
> * next system reset.
> */
> - for_each_child_of_node(dpriv->pdev->dev.of_node, child) {
> + for_each_child_of_node_scoped(dpriv->pdev->dev.of_node, child) {
> if (!of_device_is_available(child))
for_each_available_child_of_node_scoped()?
> continue;
>
> - if (of_property_read_u32(child, "reg", &port)) {
> - of_node_put(child);
> + if (of_property_read_u32(child, "reg", &port))
> return -EINVAL;
> - }
>
> port_mmio = __ahci_port_base(hpriv, port);
> dmacr = readl(port_mmio + AHCI_DWC_PORT_DMACR);
next prev parent reply other threads:[~2026-01-05 10:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-02 12:50 [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 2/3] ata: ahci-imx: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 3/3] ata: ahci-xgene: " Krzysztof Kozlowski
2026-01-05 10:52 ` Jonathan Cameron [this message]
2026-01-05 13:05 ` [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
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=20260105105252.00003b5a@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=justinstitt@google.com \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox