* [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop
@ 2025-12-24 12:45 Krzysztof Kozlowski
2025-12-24 12:45 ` [PATCH 2/2] dmaengine: xilinx: " Krzysztof Kozlowski
2026-01-01 11:51 ` [PATCH 1/2] dmaengine: axi-dmac: " Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 12:45 UTC (permalink / raw)
To: Lars-Peter Clausen, Vinod Koul, Michal Simek, dmaengine,
linux-kernel, linux-arm-kernel
Cc: 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>
---
drivers/dma/dma-axi-dmac.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index 5b06b0dc67ee..45364b1e47f4 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -925,24 +925,21 @@ static int axi_dmac_parse_chan_dt(struct device_node *of_chan,
static int axi_dmac_parse_dt(struct device *dev, struct axi_dmac *dmac)
{
- struct device_node *of_channels, *of_chan;
- int ret;
+ struct device_node *of_channels;
+ int ret = 0;
of_channels = of_get_child_by_name(dev->of_node, "adi,channels");
if (of_channels == NULL)
return -ENODEV;
- for_each_child_of_node(of_channels, of_chan) {
+ for_each_child_of_node_scoped(of_channels, of_chan) {
ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan);
- if (ret) {
- of_node_put(of_chan);
- of_node_put(of_channels);
- return -EINVAL;
- }
+ if (ret)
+ break;
}
of_node_put(of_channels);
- return 0;
+ return ret;
}
static int axi_dmac_read_chan_config(struct device *dev, struct axi_dmac *dmac)
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] dmaengine: xilinx: Simplify with scoped for each OF child loop
2025-12-24 12:45 [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2025-12-24 12:45 ` Krzysztof Kozlowski
2026-01-01 11:51 ` [PATCH 1/2] dmaengine: axi-dmac: " Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 12:45 UTC (permalink / raw)
To: Lars-Peter Clausen, Vinod Koul, Michal Simek, dmaengine,
linux-kernel, linux-arm-kernel
Cc: 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>
---
drivers/dma/xilinx/xilinx_dma.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 89a8254d9cdc..21c8bff07dcf 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -3159,7 +3159,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
= axivdma_clk_init;
struct device_node *node = pdev->dev.of_node;
struct xilinx_dma_device *xdev;
- struct device_node *child, *np = pdev->dev.of_node;
+ struct device_node *np = pdev->dev.of_node;
u32 num_frames, addr_width = XILINX_DMA_DFAULT_ADDRWIDTH, len_width;
int i, err;
@@ -3299,12 +3299,10 @@ static int xilinx_dma_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, xdev);
/* Initialize the channels */
- for_each_child_of_node(node, child) {
+ for_each_child_of_node_scoped(node, child) {
err = xilinx_dma_child_probe(xdev, child);
- if (err < 0) {
- of_node_put(child);
+ if (err < 0)
goto error;
- }
}
if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop
2025-12-24 12:45 [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 12:45 ` [PATCH 2/2] dmaengine: xilinx: " Krzysztof Kozlowski
@ 2026-01-01 11:51 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2026-01-01 11:51 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Lars-Peter Clausen, Michal Simek, dmaengine, linux-kernel,
linux-arm-kernel
On 24-12-25, 13:45, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
Hey Krzysztof,
This fails to apply for me, can you please rebase and post again
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
> drivers/dma/dma-axi-dmac.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> index 5b06b0dc67ee..45364b1e47f4 100644
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
> @@ -925,24 +925,21 @@ static int axi_dmac_parse_chan_dt(struct device_node *of_chan,
>
> static int axi_dmac_parse_dt(struct device *dev, struct axi_dmac *dmac)
> {
> - struct device_node *of_channels, *of_chan;
> - int ret;
> + struct device_node *of_channels;
> + int ret = 0;
>
> of_channels = of_get_child_by_name(dev->of_node, "adi,channels");
> if (of_channels == NULL)
> return -ENODEV;
>
> - for_each_child_of_node(of_channels, of_chan) {
> + for_each_child_of_node_scoped(of_channels, of_chan) {
> ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan);
> - if (ret) {
> - of_node_put(of_chan);
> - of_node_put(of_channels);
> - return -EINVAL;
> - }
> + if (ret)
> + break;
> }
> of_node_put(of_channels);
>
> - return 0;
> + return ret;
> }
>
> static int axi_dmac_read_chan_config(struct device *dev, struct axi_dmac *dmac)
> --
> 2.51.0
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-01 11:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-24 12:45 [PATCH 1/2] dmaengine: axi-dmac: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 12:45 ` [PATCH 2/2] dmaengine: xilinx: " Krzysztof Kozlowski
2026-01-01 11:51 ` [PATCH 1/2] dmaengine: axi-dmac: " Vinod Koul
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).