aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Zekun <[email protected]>2024-08-27 15:06:50 +0800
committerMark Brown <[email protected]>2024-09-04 18:31:15 +0100
commit815f1fcf2403454904cbbc5cf370df6bc300f392 (patch)
tree483307fa771a6b6078b3588b520b710dde42a211
parentde849243404e8ce02320a7178d4448e4d0191377 (diff)
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: Zhang Zekun <[email protected]> Reviewed-by: Kuninori Morimoto <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--sound/soc/generic/audio-graph-card2.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c
index 56f7f946882e..ebbe12692f57 100644
--- a/sound/soc/generic/audio-graph-card2.c
+++ b/sound/soc/generic/audio-graph-card2.c
@@ -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