All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [alsa-devel] [PATCH v4 11/18] ASoC: soc-core: use for_each_pcm_streams() macro
Date: 17 Feb 2020 17:28:25 +0900	[thread overview]
Message-ID: <8736b9botk.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87imk5bovg.wl-kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/soc-core.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 13df3175e184..6f3fc22e0562 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -432,6 +432,7 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
 	struct snd_soc_component *component;
 	struct device *dev;
 	int ret;
+	int stream;
 
 	/*
 	 * for rtd->dev
@@ -466,10 +467,10 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
 
 	rtd->dev = dev;
 	INIT_LIST_HEAD(&rtd->list);
-	INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients);
-	INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients);
-	INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients);
-	INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients);
+	for_each_pcm_streams(stream) {
+		INIT_LIST_HEAD(&rtd->dpcm[stream].be_clients);
+		INIT_LIST_HEAD(&rtd->dpcm[stream].fe_clients);
+	}
 	dev_set_drvdata(dev, rtd);
 	INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
 
@@ -559,17 +560,14 @@ int snd_soc_suspend(struct device *dev)
 	snd_soc_flush_all_delayed_work(card);
 
 	for_each_card_rtds(card, rtd) {
+		int stream;
 
 		if (rtd->dai_link->ignore_suspend)
 			continue;
 
-		snd_soc_dapm_stream_event(rtd,
-					  SNDRV_PCM_STREAM_PLAYBACK,
-					  SND_SOC_DAPM_STREAM_SUSPEND);
-
-		snd_soc_dapm_stream_event(rtd,
-					  SNDRV_PCM_STREAM_CAPTURE,
-					  SND_SOC_DAPM_STREAM_SUSPEND);
+		for_each_pcm_streams(stream)
+			snd_soc_dapm_stream_event(rtd, stream,
+						  SND_SOC_DAPM_STREAM_SUSPEND);
 	}
 
 	/* Recheck all endpoints too, their state is affected by suspend */
@@ -665,17 +663,14 @@ static void soc_resume_deferred(struct work_struct *work)
 	}
 
 	for_each_card_rtds(card, rtd) {
+		int stream;
 
 		if (rtd->dai_link->ignore_suspend)
 			continue;
 
-		snd_soc_dapm_stream_event(rtd,
-					  SNDRV_PCM_STREAM_PLAYBACK,
-					  SND_SOC_DAPM_STREAM_RESUME);
-
-		snd_soc_dapm_stream_event(rtd,
-					  SNDRV_PCM_STREAM_CAPTURE,
-					  SND_SOC_DAPM_STREAM_RESUME);
+		for_each_pcm_streams(stream)
+			snd_soc_dapm_stream_event(rtd, stream,
+						  SND_SOC_DAPM_STREAM_RESUME);
 	}
 
 	/* unmute any active DACs */
-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2020-02-17  8:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17  8:27 [alsa-devel] [PATCH v4 00/18] ASoC: soc-pcm cleanup step3 Kuninori Morimoto
2020-02-17  8:27 ` [alsa-devel] [PATCH v4 01/18] ASoC: soc-pcm: move dai_get_widget() Kuninori Morimoto
2020-02-17  8:27 ` [alsa-devel] [PATCH v4 02/18] ASoC: soc-pcm: use dai_get_widget() at dpcm_get_be() Kuninori Morimoto
2020-02-17  8:27 ` [alsa-devel] [PATCH v4 03/18] ASoC: soc-pcm: use dai_get_widget() at dpcm_end_walk_at_be() Kuninori Morimoto
2020-02-17  8:27 ` [alsa-devel] [PATCH v4 04/18] ASoC: soc-pcm: use dpcm_get_be() " Kuninori Morimoto
2020-02-17  8:27 ` [alsa-devel] [PATCH v4 05/18] ASoC: soc-pcm: remove soc_dpcm_be_digital_mute() Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 06/18] ASoC: soc-pcm: remove snd_soc_dpcm_be_get/set_state() Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 07/18] ASoC: soc-pcm: add snd_soc_dpcm_can_be() and remove duplicate code Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 08/18] ASoC: soc-pcm: use goto and remove multi return Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 09/18] ASoC: soc-pcm: merge playback/cature_active into stream_active Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 10/18] ALSA: pcm.h: add for_each_pcm_streams() Kuninori Morimoto
2020-02-17  8:28 ` Kuninori Morimoto [this message]
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 12/18] ASoC: soc-pcm: use for_each_pcm_streams() macro Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 13/18] ASoC: soc-generic-dmaengine-pcm: " Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 14/18] ASoC: dwc: dwc-i2s: " Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 15/18] ASoC: fsl: fsl_asrc_dma: " Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 16/18] ASoC: qcom: lpass-platform: " Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 17/18] ASoC: sof: sof-audio: " Kuninori Morimoto
2020-02-17  8:28 ` [alsa-devel] [PATCH v4 18/18] ALSA: usx2y: " Kuninori Morimoto
2020-02-18 15:56 ` [alsa-devel] [PATCH v4 00/18] ASoC: soc-pcm cleanup step3 Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736b9botk.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.