* [PATCH] soc: fsl: qe: Simplify with scoped for each OF child loop
@ 2026-01-02 12:47 Krzysztof Kozlowski
2026-01-05 12:10 ` Herve Codina
2026-01-07 7:41 ` Christophe Leroy (CS GROUP)
0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:47 UTC (permalink / raw)
To: Herve Codina, Qiang Zhao, Christophe Leroy (CS GROUP),
linuxppc-dev, linux-arm-kernel, linux-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/soc/fsl/qe/qmc.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/soc/fsl/qe/qmc.c b/drivers/soc/fsl/qe/qmc.c
index da5ea6d35618..c4587b32a59b 100644
--- a/drivers/soc/fsl/qe/qmc.c
+++ b/drivers/soc/fsl/qe/qmc.c
@@ -1284,31 +1284,26 @@ static unsigned int qmc_nb_chans(struct qmc *qmc)
static int qmc_of_parse_chans(struct qmc *qmc, struct device_node *np)
{
- struct device_node *chan_np;
struct qmc_chan *chan;
const char *mode;
u32 chan_id;
u64 ts_mask;
int ret;
- for_each_available_child_of_node(np, chan_np) {
+ for_each_available_child_of_node_scoped(np, chan_np) {
ret = of_property_read_u32(chan_np, "reg", &chan_id);
if (ret) {
dev_err(qmc->dev, "%pOF: failed to read reg\n", chan_np);
- of_node_put(chan_np);
return ret;
}
if (chan_id > 63) {
dev_err(qmc->dev, "%pOF: Invalid chan_id\n", chan_np);
- of_node_put(chan_np);
return -EINVAL;
}
chan = devm_kzalloc(qmc->dev, sizeof(*chan), GFP_KERNEL);
- if (!chan) {
- of_node_put(chan_np);
+ if (!chan)
return -ENOMEM;
- }
chan->id = chan_id;
spin_lock_init(&chan->ts_lock);
@@ -1319,7 +1314,6 @@ static int qmc_of_parse_chans(struct qmc *qmc, struct device_node *np)
if (ret) {
dev_err(qmc->dev, "%pOF: failed to read fsl,tx-ts-mask\n",
chan_np);
- of_node_put(chan_np);
return ret;
}
chan->tx_ts_mask_avail = ts_mask;
@@ -1329,7 +1323,6 @@ static int qmc_of_parse_chans(struct qmc *qmc, struct device_node *np)
if (ret) {
dev_err(qmc->dev, "%pOF: failed to read fsl,rx-ts-mask\n",
chan_np);
- of_node_put(chan_np);
return ret;
}
chan->rx_ts_mask_avail = ts_mask;
@@ -1340,7 +1333,6 @@ static int qmc_of_parse_chans(struct qmc *qmc, struct device_node *np)
if (ret && ret != -EINVAL) {
dev_err(qmc->dev, "%pOF: failed to read fsl,operational-mode\n",
chan_np);
- of_node_put(chan_np);
return ret;
}
if (!strcmp(mode, "transparent")) {
@@ -1350,7 +1342,6 @@ static int qmc_of_parse_chans(struct qmc *qmc, struct device_node *np)
} else {
dev_err(qmc->dev, "%pOF: Invalid fsl,operational-mode (%s)\n",
chan_np, mode);
- of_node_put(chan_np);
return -EINVAL;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: fsl: qe: Simplify with scoped for each OF child loop
2026-01-02 12:47 [PATCH] soc: fsl: qe: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2026-01-05 12:10 ` Herve Codina
2026-01-07 7:41 ` Christophe Leroy (CS GROUP)
1 sibling, 0 replies; 3+ messages in thread
From: Herve Codina @ 2026-01-05 12:10 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Qiang Zhao, Christophe Leroy (CS GROUP), linuxppc-dev,
linux-arm-kernel, linux-kernel
Hi Krzysztof,
On Fri, 2 Jan 2026 13:47:55 +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>
> ---
> drivers/soc/fsl/qe/qmc.c | 13 ++-----------
> 1 file changed, 2 insertions(+), 11 deletions(-)
Thanks for the patch.
Acked-by: Herve Codina <herve.codina@bootlin.com>
Best regards,
Hervé
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: fsl: qe: Simplify with scoped for each OF child loop
2026-01-02 12:47 [PATCH] soc: fsl: qe: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-05 12:10 ` Herve Codina
@ 2026-01-07 7:41 ` Christophe Leroy (CS GROUP)
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-01-07 7:41 UTC (permalink / raw)
To: Herve Codina, Qiang Zhao, linuxppc-dev, linux-arm-kernel,
linux-kernel, Krzysztof Kozlowski
Cc: Christophe Leroy
On Fri, 02 Jan 2026 13:47:55 +0100, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
>
>
Applied, thanks!
[1/1] soc: fsl: qe: Simplify with scoped for each OF child loop
commit: 66a4ff38d7b213a1278840a754c6d357e7745b24
Best regards,
--
Christophe Leroy (CS GROUP) <chleroy@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-07 7:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 12:47 [PATCH] soc: fsl: qe: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-05 12:10 ` Herve Codina
2026-01-07 7:41 ` Christophe Leroy (CS GROUP)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox