Commit 815f1fcf authored by Zhang Zekun's avatar Zhang Zekun Committed by Mark Brown

ASoC: audio-graph-card2: Use helper function of_get_child_count()

of_get_child_count() can help to get the num of child directly and we
don't need to manually count the child num. No functional change with
this conversion.
Signed-off-by: default avatarZhang Zekun <zhangzekun11@huawei.com>
Reviewed-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20240827070650.11424-3-zhangzekun11@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent de849243
......@@ -1141,21 +1141,12 @@ static int graph_counter(struct device_node *lnk)
*/
if (graph_lnk_is_multi(lnk)) {
struct device_node *ports = port_to_ports(lnk);
struct device_node *port = NULL;
int cnt = 0;
/*
* CPU/Codec = N:M case has many endpoints.
* We can't use of_graph_get_endpoint_count() here
*/
while(1) {
port = of_get_next_child(ports, port);
if (!port)
break;
cnt++;
}
return cnt - 1;
return of_get_child_count(ports) - 1;
}
/*
* Single CPU / Codec
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment