* [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped()
@ 2026-01-06 9:15 Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper Krzysztof Kozlowski
` (10 more replies)
0 siblings, 11 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Jonathan Cameron, Krzysztof Kozlowski
Dependencies/merging
====================
1. First patch is a prerequisite for entire set, so either everything
goes via same tree, the further patches wait a cycle or stable tag is
shared from DT tree.
2. The last media patch depends on my earlier cleanup.
Changes in v2:
- Update also scripts/dtc/dt-extract-compatibles (Rob)
- Collect tags
- Link to v1: https://patch.msgid.link/20260105-of-for-each-compatible-scoped-v1-0-24e99c177164@oss.qualcomm.com
Description
===========
Simplify for_each_compatible_node() users with a new helper -
for_each_compatible_node_scoped().
Best regards,
Krzysztof
---
Krzysztof Kozlowski (11):
of: Add for_each_compatible_node_scoped() helper
ARM: at91: Simplify with scoped for each OF child loop
ARM: exynos: Simplify with scoped for each OF child loop
powerpc/fsp2: Simplify with scoped for each OF child loop
powerpc/wii: Simplify with scoped for each OF child loop
cdx: Simplify with scoped for each OF child loop
clk: imx: imx27: Simplify with scoped for each OF child loop
clk: imx: imx31: Simplify with scoped for each OF child loop
dmaengine: fsl_raid: Simplify with scoped for each OF child loop
cpufreq: s5pv210: Simplify with scoped for each OF child loop
media: samsung: exynos4-is: Simplify with scoped for each OF child loop
.clang-format | 1 +
arch/arm/mach-at91/pm.c | 7 ++-----
arch/arm/mach-exynos/exynos.c | 8 ++------
arch/powerpc/platforms/44x/fsp2.c | 5 +----
arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 4 +---
drivers/cdx/cdx.c | 4 +---
drivers/clk/imx/clk-imx27.c | 7 ++-----
drivers/clk/imx/clk-imx31.c | 7 ++-----
drivers/cpufreq/s5pv210-cpufreq.c | 10 ++++------
drivers/dma/fsl_raid.c | 4 +---
drivers/media/platform/samsung/exynos4-is/fimc-is.c | 8 +++-----
include/linux/of.h | 7 +++++++
scripts/dtc/dt-extract-compatibles | 1 +
13 files changed, 28 insertions(+), 45 deletions(-)
---
base-commit: 4d27ce1b1abefb22e277e715901cc52acdc5af2c
change-id: 20260105-of-for-each-compatible-scoped-285b3dbda253
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 10:37 ` Jonathan Cameron
2026-01-06 9:15 ` [PATCH v2 02/11] ARM: at91: Simplify with scoped for each OF child loop Krzysztof Kozlowski
` (9 subsequent siblings)
10 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Jonathan Cameron, Krzysztof Kozlowski
Just like looping through children and available children, add a scoped
helper for for_each_compatible_node() so error paths can drop
of_node_put() leading to simpler code.
Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Prerequisite for all further patches.
---
.clang-format | 1 +
include/linux/of.h | 7 +++++++
| 1 +
3 files changed, 9 insertions(+)
diff --git a/.clang-format b/.clang-format
index c7060124a47a..1cc151e2adcc 100644
--- a/.clang-format
+++ b/.clang-format
@@ -259,6 +259,7 @@ ForEachMacros:
- 'for_each_collection'
- 'for_each_comp_order'
- 'for_each_compatible_node'
+ - 'for_each_compatible_node_scoped'
- 'for_each_component_dais'
- 'for_each_component_dais_safe'
- 'for_each_conduit'
diff --git a/include/linux/of.h b/include/linux/of.h
index 9bbdcf25a2b4..be6ec4916adf 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1485,6 +1485,13 @@ static inline int of_property_read_s32(const struct device_node *np,
#define for_each_compatible_node(dn, type, compatible) \
for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
dn = of_find_compatible_node(dn, type, compatible))
+
+#define for_each_compatible_node_scoped(dn, type, compatible) \
+ for (struct device_node *dn __free(device_node) = \
+ of_find_compatible_node(NULL, type, compatible); \
+ dn; \
+ dn = of_find_compatible_node(dn, type, compatible))
+
#define for_each_matching_node(dn, matches) \
for (dn = of_find_matching_node(NULL, matches); dn; \
dn = of_find_matching_node(dn, matches))
--git a/scripts/dtc/dt-extract-compatibles b/scripts/dtc/dt-extract-compatibles
index 6570efabaa64..87999d707390 100755
--- a/scripts/dtc/dt-extract-compatibles
+++ b/scripts/dtc/dt-extract-compatibles
@@ -72,6 +72,7 @@ def parse_compatibles(file, compat_ignore_list):
compat_list += parse_of_functions(data, "_is_compatible")
compat_list += parse_of_functions(data, "of_find_compatible_node")
compat_list += parse_of_functions(data, "for_each_compatible_node")
+ compat_list += parse_of_functions(data, "for_each_compatible_node_scoped")
compat_list += parse_of_functions(data, "of_get_compatible_child")
return compat_list
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 02/11] ARM: at91: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 03/11] ARM: exynos: " Krzysztof Kozlowski
` (8 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Depends on the first patch.
---
arch/arm/mach-at91/pm.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 35058b99069c..68bb4a86cd94 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -982,15 +982,12 @@ static void __init at91_pm_sram_init(void)
struct gen_pool *sram_pool;
phys_addr_t sram_pbase;
unsigned long sram_base;
- struct device_node *node;
struct platform_device *pdev = NULL;
- for_each_compatible_node(node, NULL, "mmio-sram") {
+ for_each_compatible_node_scoped(node, NULL, "mmio-sram") {
pdev = of_find_device_by_node(node);
- if (pdev) {
- of_node_put(node);
+ if (pdev)
break;
- }
}
if (!pdev) {
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 03/11] ARM: exynos: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 02/11] ARM: at91: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 04/11] powerpc/fsp2: " Krzysztof Kozlowski
` (7 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
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>
---
Depends on the first patch.
---
arch/arm/mach-exynos/exynos.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 2e8099479ffa..18695076c34e 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -47,9 +47,7 @@ unsigned int exynos_rev(void)
void __init exynos_sysram_init(void)
{
- struct device_node *node;
-
- for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
+ for_each_compatible_node_scoped(node, NULL, "samsung,exynos4210-sysram") {
struct resource res;
if (!of_device_is_available(node))
continue;
@@ -57,15 +55,13 @@ void __init exynos_sysram_init(void)
of_address_to_resource(node, 0, &res);
sysram_base_addr = ioremap(res.start, resource_size(&res));
sysram_base_phys = res.start;
- of_node_put(node);
break;
}
- for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
+ for_each_compatible_node_scoped(node, NULL, "samsung,exynos4210-sysram-ns") {
if (!of_device_is_available(node))
continue;
sysram_ns_base_addr = of_iomap(node, 0);
- of_node_put(node);
break;
}
}
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 04/11] powerpc/fsp2: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (2 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 03/11] ARM: exynos: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 05/11] powerpc/wii: " Krzysztof Kozlowski
` (6 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
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>
---
Depends on the first patch.
---
arch/powerpc/platforms/44x/fsp2.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/44x/fsp2.c b/arch/powerpc/platforms/44x/fsp2.c
index f6b8d02e08b0..b06d9220844c 100644
--- a/arch/powerpc/platforms/44x/fsp2.c
+++ b/arch/powerpc/platforms/44x/fsp2.c
@@ -199,16 +199,14 @@ static irqreturn_t rst_wrn_handler(int irq, void *data) {
static void __init node_irq_request(const char *compat, irq_handler_t errirq_handler)
{
- struct device_node *np;
unsigned int irq;
int32_t rc;
- for_each_compatible_node(np, NULL, compat) {
+ for_each_compatible_node_scoped(np, NULL, compat) {
irq = irq_of_parse_and_map(np, 0);
if (!irq) {
pr_err("device tree node %pOFn is missing a interrupt",
np);
- of_node_put(np);
return;
}
@@ -216,7 +214,6 @@ static void __init node_irq_request(const char *compat, irq_handler_t errirq_han
if (rc) {
pr_err("fsp_of_probe: request_irq failed: np=%pOF rc=%d",
np, rc);
- of_node_put(np);
return;
}
}
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 05/11] powerpc/wii: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (3 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 04/11] powerpc/fsp2: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 06/11] cdx: " Krzysztof Kozlowski
` (5 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
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>
---
Depends on the first patch.
---
arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index b57e87b0b3ce..1522a8bece29 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -201,11 +201,10 @@ unsigned int hlwd_pic_get_irq(void)
void __init hlwd_pic_probe(void)
{
struct irq_domain *host;
- struct device_node *np;
const u32 *interrupts;
int cascade_virq;
- for_each_compatible_node(np, NULL, "nintendo,hollywood-pic") {
+ for_each_compatible_node_scoped(np, NULL, "nintendo,hollywood-pic") {
interrupts = of_get_property(np, "interrupts", NULL);
if (interrupts) {
host = hlwd_pic_init(np);
@@ -215,7 +214,6 @@ void __init hlwd_pic_probe(void)
irq_set_chained_handler(cascade_virq,
hlwd_pic_irq_cascade);
hlwd_irq_host = host;
- of_node_put(np);
break;
}
}
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 06/11] cdx: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (4 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 05/11] powerpc/wii: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 07/11] clk: imx: imx27: " Krzysztof Kozlowski
` (4 subsequent siblings)
10 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
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>
---
Depends on the first patch.
---
drivers/cdx/cdx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
index b39af2f1937f..bbde529aaa93 100644
--- a/drivers/cdx/cdx.c
+++ b/drivers/cdx/cdx.c
@@ -608,7 +608,6 @@ static ssize_t rescan_store(const struct bus_type *bus,
{
struct cdx_controller *cdx;
struct platform_device *pd;
- struct device_node *np;
bool val;
if (kstrtobool(buf, &val) < 0)
@@ -623,10 +622,9 @@ static ssize_t rescan_store(const struct bus_type *bus,
cdx_unregister_devices(&cdx_bus_type);
/* Rescan all the devices */
- for_each_compatible_node(np, NULL, compat_node_name) {
+ for_each_compatible_node_scoped(np, NULL, compat_node_name) {
pd = of_find_device_by_node(np);
if (!pd) {
- of_node_put(np);
count = -EINVAL;
goto unlock;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 07/11] clk: imx: imx27: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (5 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 06/11] cdx: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 14:54 ` Frank Li
2026-01-06 17:34 ` Abel Vesa
2026-01-06 9:15 ` [PATCH v2 08/11] clk: imx: imx31: " Krzysztof Kozlowski
` (3 subsequent siblings)
10 siblings, 2 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Depends on first patch.
---
drivers/clk/imx/clk-imx27.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/imx/clk-imx27.c b/drivers/clk/imx/clk-imx27.c
index 99618ded0939..f2f0d3fe5c52 100644
--- a/drivers/clk/imx/clk-imx27.c
+++ b/drivers/clk/imx/clk-imx27.c
@@ -171,17 +171,14 @@ static void __init _mx27_clocks_init(unsigned long fref)
static void __init mx27_clocks_init_dt(struct device_node *np)
{
- struct device_node *refnp;
u32 fref = 26000000; /* default */
- for_each_compatible_node(refnp, NULL, "fixed-clock") {
+ for_each_compatible_node_scoped(refnp, NULL, "fixed-clock") {
if (!of_device_is_compatible(refnp, "fsl,imx-osc26m"))
continue;
- if (!of_property_read_u32(refnp, "clock-frequency", &fref)) {
- of_node_put(refnp);
+ if (!of_property_read_u32(refnp, "clock-frequency", &fref))
break;
- }
}
ccm = of_iomap(np, 0);
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 08/11] clk: imx: imx31: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (6 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 07/11] clk: imx: imx27: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 14:54 ` Frank Li
2026-01-06 17:31 ` Abel Vesa
2026-01-06 9:15 ` [PATCH v2 09/11] dmaengine: fsl_raid: " Krzysztof Kozlowski
` (2 subsequent siblings)
10 siblings, 2 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
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);
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 09/11] dmaengine: fsl_raid: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (7 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 08/11] clk: imx: imx31: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 14:55 ` Frank Li
2026-01-09 3:07 ` Vinod Koul
2026-01-06 9:15 ` [PATCH v2 10/11] cpufreq: s5pv210: " Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 11/11] media: samsung: exynos4-is: " Krzysztof Kozlowski
10 siblings, 2 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
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>
---
Depends on the first patch.
---
drivers/dma/fsl_raid.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c
index 6aa97e258a55..6e6d7e0e475e 100644
--- a/drivers/dma/fsl_raid.c
+++ b/drivers/dma/fsl_raid.c
@@ -746,7 +746,6 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,
static int fsl_re_probe(struct platform_device *ofdev)
{
struct fsl_re_drv_private *re_priv;
- struct device_node *np;
struct device_node *child;
u32 off;
u8 ridx = 0;
@@ -823,11 +822,10 @@ static int fsl_re_probe(struct platform_device *ofdev)
dev_set_drvdata(dev, re_priv);
/* Parse Device tree to find out the total number of JQs present */
- for_each_compatible_node(np, NULL, "fsl,raideng-v1.0-job-queue") {
+ for_each_compatible_node_scoped(np, NULL, "fsl,raideng-v1.0-job-queue") {
rc = of_property_read_u32(np, "reg", &off);
if (rc) {
dev_err(dev, "Reg property not found in JQ node\n");
- of_node_put(np);
return -ENODEV;
}
/* Find out the Job Rings present under each JQ */
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 10/11] cpufreq: s5pv210: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (8 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 09/11] dmaengine: fsl_raid: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 11/11] media: samsung: exynos4-is: " Krzysztof Kozlowski
10 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler. Note that there is another part of code using "np"
variable, so scoped loop should not shadow it.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Depends on the first patch.
---
drivers/cpufreq/s5pv210-cpufreq.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index ba8a1c96427a..e64e84e1ee79 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -629,19 +629,17 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
goto err_clock;
}
- for_each_compatible_node(np, NULL, "samsung,s5pv210-dmc") {
- id = of_alias_get_id(np, "dmc");
+ for_each_compatible_node_scoped(dmc, NULL, "samsung,s5pv210-dmc") {
+ id = of_alias_get_id(dmc, "dmc");
if (id < 0 || id >= ARRAY_SIZE(dmc_base)) {
- dev_err(dev, "failed to get alias of dmc node '%pOFn'\n", np);
- of_node_put(np);
+ dev_err(dev, "failed to get alias of dmc node '%pOFn'\n", dmc);
result = id;
goto err_clk_base;
}
- dmc_base[id] = of_iomap(np, 0);
+ dmc_base[id] = of_iomap(dmc, 0);
if (!dmc_base[id]) {
dev_err(dev, "failed to map dmc%d registers\n", id);
- of_node_put(np);
result = -EFAULT;
goto err_dmc;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 11/11] media: samsung: exynos4-is: Simplify with scoped for each OF child loop
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
` (9 preceding siblings ...)
2026-01-06 9:15 ` [PATCH v2 10/11] cpufreq: s5pv210: " Krzysztof Kozlowski
@ 2026-01-06 9:15 ` Krzysztof Kozlowski
10 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 9:15 UTC (permalink / raw)
To: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar
Cc: linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm, Krzysztof Kozlowski
Use scoped for_each_compatible_node_scoped() loop when iterating over
device nodes to make code a bit simpler.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Depends on the first patch and on:
https://lore.kernel.org/all/20260102124955.64904-2-krzysztof.kozlowski@oss.qualcomm.com/
---
drivers/media/platform/samsung/exynos4-is/fimc-is.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c
index 14d84cc96831..b7d9bfedd590 100644
--- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c
+++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c
@@ -200,21 +200,19 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index,
static int fimc_is_register_subdevs(struct fimc_is *is)
{
- struct device_node *i2c_bus;
int ret, index = 0;
ret = fimc_isp_subdev_create(&is->isp);
if (ret < 0)
return ret;
- for_each_compatible_node(i2c_bus, NULL, "samsung,exynos4212-i2c-isp") {
+ for_each_compatible_node_scoped(i2c_bus, NULL, "samsung,exynos4212-i2c-isp") {
for_each_available_child_of_node_scoped(i2c_bus, child) {
ret = fimc_is_parse_sensor_config(is, index, child);
- if (ret < 0 || index >= FIMC_IS_SENSORS_NUM) {
- of_node_put(i2c_bus);
+ if (ret < 0 || index >= FIMC_IS_SENSORS_NUM)
return ret;
- }
+
index++;
}
}
--
2.51.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper
2026-01-06 9:15 ` [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper Krzysztof Kozlowski
@ 2026-01-06 10:37 ` Jonathan Cameron
2026-01-06 11:26 ` Krzysztof Kozlowski
0 siblings, 1 reply; 20+ messages in thread
From: Jonathan Cameron @ 2026-01-06 10:37 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar, linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On Tue, 06 Jan 2026 10:15:11 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
> Just like looping through children and available children, add a scoped
> helper for for_each_compatible_node() so error paths can drop
> of_node_put() leading to simpler code.
>
> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Oops. Reviews on v1 as I didn't check for a v2. Sorry about that.
J
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper
2026-01-06 10:37 ` Jonathan Cameron
@ 2026-01-06 11:26 ` Krzysztof Kozlowski
0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-06 11:26 UTC (permalink / raw)
To: Jonathan Cameron, Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Alim Akhtar,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Nipun Gupta, Nikhil Agarwal,
Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar, linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On 06/01/2026 11:37, Jonathan Cameron wrote:
> On Tue, 06 Jan 2026 10:15:11 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
>
>> Just like looping through children and available children, add a scoped
>> helper for for_each_compatible_node() so error paths can drop
>> of_node_put() leading to simpler code.
>>
>> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> Oops. Reviews on v1 as I didn't check for a v2. Sorry about that.
Yeah, I saw them. I'll go through them anyway, so probably there will be
v3 or I will just respin with added tags.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 07/11] clk: imx: imx27: Simplify with scoped for each OF child loop
2026-01-06 9:15 ` [PATCH v2 07/11] clk: imx: imx27: " Krzysztof Kozlowski
@ 2026-01-06 14:54 ` Frank Li
2026-01-06 17:34 ` Abel Vesa
1 sibling, 0 replies; 20+ messages in thread
From: Frank Li @ 2026-01-06 14:54 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar, linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On Tue, Jan 06, 2026 at 10:15:17AM +0100, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
>
> Depends on first patch.
> ---
> drivers/clk/imx/clk-imx27.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-imx27.c b/drivers/clk/imx/clk-imx27.c
> index 99618ded0939..f2f0d3fe5c52 100644
> --- a/drivers/clk/imx/clk-imx27.c
> +++ b/drivers/clk/imx/clk-imx27.c
> @@ -171,17 +171,14 @@ static void __init _mx27_clocks_init(unsigned long fref)
>
> static void __init mx27_clocks_init_dt(struct device_node *np)
> {
> - struct device_node *refnp;
> u32 fref = 26000000; /* default */
>
> - for_each_compatible_node(refnp, NULL, "fixed-clock") {
> + for_each_compatible_node_scoped(refnp, NULL, "fixed-clock") {
> if (!of_device_is_compatible(refnp, "fsl,imx-osc26m"))
> continue;
>
> - if (!of_property_read_u32(refnp, "clock-frequency", &fref)) {
> - of_node_put(refnp);
> + if (!of_property_read_u32(refnp, "clock-frequency", &fref))
> break;
> - }
> }
>
> ccm = of_iomap(np, 0);
>
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 08/11] clk: imx: imx31: Simplify with scoped for each OF child loop
2026-01-06 9:15 ` [PATCH v2 08/11] clk: imx: imx31: " Krzysztof Kozlowski
@ 2026-01-06 14:54 ` Frank Li
2026-01-06 17:31 ` Abel Vesa
1 sibling, 0 replies; 20+ messages in thread
From: Frank Li @ 2026-01-06 14:54 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar, linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On Tue, Jan 06, 2026 at 10:15:18AM +0100, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
>
> 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);
>
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 09/11] dmaengine: fsl_raid: Simplify with scoped for each OF child loop
2026-01-06 9:15 ` [PATCH v2 09/11] dmaengine: fsl_raid: " Krzysztof Kozlowski
@ 2026-01-06 14:55 ` Frank Li
2026-01-09 3:07 ` Vinod Koul
1 sibling, 0 replies; 20+ messages in thread
From: Frank Li @ 2026-01-06 14:55 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar, linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On Tue, Jan 06, 2026 at 10:15:19AM +0100, Krzysztof Kozlowski 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>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> ---
>
> Depends on the first patch.
> ---
> drivers/dma/fsl_raid.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c
> index 6aa97e258a55..6e6d7e0e475e 100644
> --- a/drivers/dma/fsl_raid.c
> +++ b/drivers/dma/fsl_raid.c
> @@ -746,7 +746,6 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,
> static int fsl_re_probe(struct platform_device *ofdev)
> {
> struct fsl_re_drv_private *re_priv;
> - struct device_node *np;
> struct device_node *child;
> u32 off;
> u8 ridx = 0;
> @@ -823,11 +822,10 @@ static int fsl_re_probe(struct platform_device *ofdev)
> dev_set_drvdata(dev, re_priv);
>
> /* Parse Device tree to find out the total number of JQs present */
> - for_each_compatible_node(np, NULL, "fsl,raideng-v1.0-job-queue") {
> + for_each_compatible_node_scoped(np, NULL, "fsl,raideng-v1.0-job-queue") {
> rc = of_property_read_u32(np, "reg", &off);
> if (rc) {
> dev_err(dev, "Reg property not found in JQ node\n");
> - of_node_put(np);
> return -ENODEV;
> }
> /* Find out the Job Rings present under each JQ */
>
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 08/11] clk: imx: imx31: Simplify with scoped for each OF child loop
2026-01-06 9:15 ` [PATCH v2 08/11] clk: imx: imx31: " Krzysztof Kozlowski
2026-01-06 14:54 ` Frank Li
@ 2026-01-06 17:31 ` Abel Vesa
1 sibling, 0 replies; 20+ messages in thread
From: Abel Vesa @ 2026-01-06 17:31 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar, linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On 26-01-06 10:15:18, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Acked-by: Abel Vesa <abelvesa@kernel.org>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 07/11] clk: imx: imx27: Simplify with scoped for each OF child loop
2026-01-06 9:15 ` [PATCH v2 07/11] clk: imx: imx27: " Krzysztof Kozlowski
2026-01-06 14:54 ` Frank Li
@ 2026-01-06 17:34 ` Abel Vesa
1 sibling, 0 replies; 20+ messages in thread
From: Abel Vesa @ 2026-01-06 17:34 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Vinod Koul,
Sylwester Nawrocki, Mauro Carvalho Chehab, Rafael J. Wysocki,
Viresh Kumar, linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On 26-01-06 10:15:17, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Acked-by: Abel Vesa <abelvesa@kernel.org>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 09/11] dmaengine: fsl_raid: Simplify with scoped for each OF child loop
2026-01-06 9:15 ` [PATCH v2 09/11] dmaengine: fsl_raid: " Krzysztof Kozlowski
2026-01-06 14:55 ` Frank Li
@ 2026-01-09 3:07 ` Vinod Koul
1 sibling, 0 replies; 20+ messages in thread
From: Vinod Koul @ 2026-01-09 3:07 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Miguel Ojeda, Rob Herring, Saravana Kannan, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, Russell King,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Krzysztof Kozlowski, Alim Akhtar, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Nipun Gupta, Nikhil Agarwal, Abel Vesa, Peng Fan,
Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Sylwester Nawrocki,
Mauro Carvalho Chehab, Rafael J. Wysocki, Viresh Kumar,
linux-kernel, devicetree, llvm, linux-arm-kernel,
linux-samsung-soc, linuxppc-dev, linux-clk, imx, dmaengine,
linux-media, linux-pm
On 06-01-26, 10:15, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-01-09 3:07 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 9:15 [PATCH v2 00/11] of/treewide: Simplify with for_each_compatible_node_scoped() Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 01/11] of: Add for_each_compatible_node_scoped() helper Krzysztof Kozlowski
2026-01-06 10:37 ` Jonathan Cameron
2026-01-06 11:26 ` Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 02/11] ARM: at91: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 03/11] ARM: exynos: " Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 04/11] powerpc/fsp2: " Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 05/11] powerpc/wii: " Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 06/11] cdx: " Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 07/11] clk: imx: imx27: " Krzysztof Kozlowski
2026-01-06 14:54 ` Frank Li
2026-01-06 17:34 ` Abel Vesa
2026-01-06 9:15 ` [PATCH v2 08/11] clk: imx: imx31: " Krzysztof Kozlowski
2026-01-06 14:54 ` Frank Li
2026-01-06 17:31 ` Abel Vesa
2026-01-06 9:15 ` [PATCH v2 09/11] dmaengine: fsl_raid: " Krzysztof Kozlowski
2026-01-06 14:55 ` Frank Li
2026-01-09 3:07 ` Vinod Koul
2026-01-06 9:15 ` [PATCH v2 10/11] cpufreq: s5pv210: " Krzysztof Kozlowski
2026-01-06 9:15 ` [PATCH v2 11/11] media: samsung: exynos4-is: " Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).