diff mbox series

[v2,04/10] ASoC: soc-pcm: use dpcm_get_be() at dpcm_end_walk_at_be()

Message ID 87mu9lzyiy.wl-kuninori.morimoto.gx@renesas.com
State Superseded
Headers show
Series [v2,01/10] ASoC: soc-pcm: move dai_get_widget() | expand

Commit Message

Kuninori Morimoto Feb. 14, 2020, 2:35 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

dpcm_end_walk_at_be() and dpcm_get_be() are almost same code.
This patch uses dpcm_get_be() from dpcm_end_walk_at_be().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

	- no change

 sound/soc/soc-pcm.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 62ca275f02b0..18fbf27aad01 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1297,10 +1297,7 @@  static bool dpcm_end_walk_at_be(struct snd_soc_dapm_widget *widget,
 {
 	struct snd_soc_card *card = widget->dapm->card;
 	struct snd_soc_pcm_runtime *rtd;
-	struct snd_soc_dapm_widget *w;
-	struct snd_soc_dai *dai;
 	int stream;
-	int i;
 
 	/* adjust dir to stream */
 	if (dir == SND_SOC_DAPM_DIR_OUT)
@@ -1308,20 +1305,9 @@  static bool dpcm_end_walk_at_be(struct snd_soc_dapm_widget *widget,
 	else
 		stream = SNDRV_PCM_STREAM_CAPTURE;
 
-	for_each_card_rtds(card, rtd) {
-		if (!rtd->dai_link->no_pcm)
-			continue;
-
-		w = dai_get_widget(rtd->cpu_dai, stream);
-		if (w == widget)
-			return true;
-
-		for_each_rtd_codec_dai(rtd, i, dai) {
-			w = dai_get_widget(dai, stream);
-			if (w == widget)
-				return true;
-		}
-	}
+	rtd = dpcm_get_be(card, widget, stream);
+	if (rtd)
+		return true;
 
 	return false;
 }