Thread (34 messages) 34 messages, 7 authors, 2026-01-10

Re: [PATCH 08/11] clk: imx: imx31: Simplify with scoped for each OF child loop

From: Jonathan Cameron <jonathan.cameron@huawei.com>
Date: 2026-01-06 10:23:50
Also in: dmaengine, imx, linux-arm-kernel, linux-clk, linux-devicetree, linux-media, linux-pm, linux-samsung-soc, lkml, llvm

On Mon, 05 Jan 2026 14:33:46 +0100
Krzysztof Kozlowski [off-list ref] wrote:
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <redacted>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

I guess this is papering over similar compatibility issues with old DT
as the previous one (so fsl,imx-osc26m which may or may not have fallback
compatible to fixed-clock).

Jonathan
quoted hunk ↗ jump to hunk
---

Depends on first patch.
---
 drivers/clk/imx/clk-imx31.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/imx/clk-imx31.c b/drivers/clk/imx/clk-imx31.c
index 4c8d9ff0b2ad..962eccac63ce 100644
--- a/drivers/clk/imx/clk-imx31.c
+++ b/drivers/clk/imx/clk-imx31.c
@@ -123,18 +123,15 @@ static void __init _mx31_clocks_init(void __iomem *base, unsigned long fref)
 
 static void __init mx31_clocks_init_dt(struct device_node *np)
 {
-	struct device_node *osc_np;
 	u32 fref = 26000000; /* default */
 	void __iomem *ccm;
 
-	for_each_compatible_node(osc_np, NULL, "fixed-clock") {
+	for_each_compatible_node_scoped(osc_np, NULL, "fixed-clock") {
 		if (!of_device_is_compatible(osc_np, "fsl,imx-osc26m"))
 			continue;
 
-		if (!of_property_read_u32(osc_np, "clock-frequency", &fref)) {
-			of_node_put(osc_np);
+		if (!of_property_read_u32(osc_np, "clock-frequency", &fref))
 			break;
-		}
 	}
 
 	ccm = of_iomap(np, 0);
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help