[PATCH v4 4/9] ASoC: rcar_snd: use new of_graph functions

Rob Herring robh at kernel.org
Thu Aug 29 15:41:02 UTC 2024


On Wed, Aug 28, 2024 at 05:11:56AM +0000, Kuninori Morimoto wrote:
> Now we can use new port related functions for port parsing. Use it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> Acked-by: Mark Brown <broonie at kernel.org>
> ---
>  sound/soc/sh/rcar/core.c | 21 +++++++--------------
>  1 file changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
> index 15cb5e7008f9f..281936ece760b 100644
> --- a/sound/soc/sh/rcar/core.c
> +++ b/sound/soc/sh/rcar/core.c
> @@ -1237,7 +1237,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph)
>  {
>  	struct device *dev = rsnd_priv_to_dev(priv);
>  	struct device_node *np = dev->of_node;
> -	struct device_node *ports, *node;
> +	struct device_node *node;
>  	int nr = 0;
>  	int i = 0;
>  
> @@ -1277,16 +1277,12 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph)
>  	/*
>  	 * Audio-Graph-Card
>  	 */
> -	for_each_child_of_node(np, ports) {
> -		if (!of_node_name_eq(ports, "ports") &&
> -		    !of_node_name_eq(ports, "port"))
> -			continue;
> -		priv->component_dais[i] = of_graph_get_endpoint_count(ports);
> +	for_each_of_graph_ports(np, ports) {
> +		priv->component_dais[i] = of_graph_get_port_count(ports);

These are not equivalent. Besides now working with multiple 'ports' 
nodes, it's possible to have a port node without an endpoint populated 
for example.

Rob


More information about the dri-devel mailing list