Thread (5 messages) 5 messages, 2 authors, 2026-01-05

Re: [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop

From: Krzysztof Kozlowski <hidden>
Date: 2026-01-05 13:05:35
Also in: imx, linux-ide, lkml, llvm

On 05/01/2026 11:52, Jonathan Cameron wrote:
On Fri,  2 Jan 2026 13:50:41 +0100
Krzysztof Kozlowski [off-list ref] wrote:
quoted
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <redacted>
A whilst you are here suggestion inline to make it a bit simpler.
quoted
---
 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()?
Huh, indeed I did not notice it. Thanks!



Best regards,
Krzysztof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help