mbox series

[0/6] Use helper function for_each_child_of_node_scoped()

Message ID 20250520091131.4150248-1-aichao@kylinos.cn
Headers show
Series Use helper function for_each_child_of_node_scoped() | expand

Message

Ai Chao May 20, 2025, 9:11 a.m. UTC
This patch series introduces wrapper functions
for_each_child_of_node_scoped(). 

The for_each_child_of_node_scoped() helper provides a scope-based clean-up
functionality to put the device_node automatically, and as such, there is
no need to call of_node_put() directly.

Thus, use this helper to simplify the code.

Summary:

 - Patch 1 ASoC: ppc: Use helper function for_each_child_of_node_scoped()

 - Patch 2 ASoC: aoa: Use helper function for_each_child_of_node_scoped()

 - Patch 3 ASoC: renesas: Use helper function for_each_child_of_node_scoped()

 - Patch 4 ASoC: meson: Use helper function for_each_child_of_node_scoped()

 - Patch 5 ASoC: imx-card: Use helper function for_each_child_of_node_scoped()

 - Patch 6 ASoC: qcom: Use helper function for_each_child_of_node_scoped()

 sound/aoa/soundbus/i2sbus/core.c   |  5 ++--
 sound/ppc/tumbler.c                |  5 ++--
 sound/soc/fsl/imx-card.c           | 13 ++++------
 sound/soc/meson/axg-card.c         |  3 +--
 sound/soc/meson/meson-card-utils.c | 14 +++--------
 sound/soc/qcom/lpass-cpu.c         |  3 +--
 sound/soc/qcom/qdsp6/q6afe-dai.c   |  3 +--
 sound/soc/qcom/qdsp6/q6asm-dai.c   |  4 +--
 sound/soc/renesas/rcar/core.c      | 39 ++++++++++--------------------
 sound/soc/renesas/rcar/ctu.c       |  8 ++----
 sound/soc/renesas/rcar/dma.c       |  4 +--
 sound/soc/renesas/rcar/dvc.c       |  8 ++----
 sound/soc/renesas/rcar/mix.c       |  8 ++----
 sound/soc/renesas/rcar/src.c       | 10 ++------
 sound/soc/renesas/rcar/ssi.c       | 18 ++++----------
 sound/soc/renesas/rcar/ssiu.c      |  7 ++----
 16 files changed, 47 insertions(+), 105 deletions(-)

Comments

Kuninori Morimoto May 21, 2025, 11:43 p.m. UTC | #1
Hi Ai

Thank you for the patch

> The for_each_child_of_node_scoped() helper provides a scope-based
> clean-up functionality to put the device_node automatically, and
> as such, there is no need to call of_node_put() directly.
> 
> Thus, use this helper to simplify the code.
> 
> Signed-off-by: Ai Chao <aichao@kylinos.cn>
> ---
(snip)
> @@ -1270,16 +1263,15 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph)
>  
>  	of_node_put(node);
>  
> -	for_each_child_of_node(np, node) {
> -		if (!of_node_name_eq(node, RSND_NODE_DAI))
> +	for_each_child_of_node_scoped(np, ports) {
> +		if (!of_node_name_eq(ports, RSND_NODE_DAI))
>  			continue;
>  
> -		priv->component_dais[i] = of_get_child_count(node);
> +		priv->component_dais[i] = of_get_child_count(ports);
>  		nr += priv->component_dais[i];
>  		i++;
>  		if (i >= RSND_MAX_COMPONENT) {
>  			dev_info(dev, "reach to max component\n");
> -			of_node_put(node);
>  			break;
>  		}
>  	}

Here changes "node" to "ports", but please keep "node".
Here is checking "node" instead of "ports".

Except this

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto