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 v3 7/8] ASoC: soc-pcm: move soc_pcm_close() next to soc_pcm_open()
Date: 10 Feb 2020 12:14:41 +0900	[thread overview]
Message-ID: <8736bjcexx.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87d0anceze.wl-kuninori.morimoto.gx@renesas.com>

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

This patch moves soc_pcm_close() next to soc_pcm_open().
This is prepare for soc_pcm_open() cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
v2 -> v3

	- add Ranjani's Reviewed-by

 sound/soc/soc-pcm.c | 88 ++++++++++++++++++++++++++---------------------------
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index ae94d8a..8aa775e0 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -508,6 +508,50 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream)
 }
 
 /*
+ * Called by ALSA when a PCM substream is closed. Private data can be
+ * freed here. The cpu DAI, codec DAI, machine and components are also
+ * shutdown.
+ */
+static int soc_pcm_close(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_component *component;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct snd_soc_dai *codec_dai;
+	int i;
+
+	mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
+
+	snd_soc_runtime_deactivate(rtd, substream->stream);
+
+	snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream);
+
+	snd_soc_dai_shutdown(cpu_dai, substream);
+
+	for_each_rtd_codec_dai(rtd, i, codec_dai)
+		snd_soc_dai_shutdown(codec_dai, substream);
+
+	soc_rtd_shutdown(rtd, substream);
+
+	soc_pcm_components_close(substream);
+
+	snd_soc_dapm_stream_stop(rtd, substream->stream);
+
+	mutex_unlock(&rtd->card->pcm_mutex);
+
+	for_each_rtd_components(rtd, i, component) {
+		pm_runtime_mark_last_busy(component->dev);
+		pm_runtime_put_autosuspend(component->dev);
+	}
+
+	for_each_rtd_components(rtd, i, component)
+		if (!component->active)
+			pinctrl_pm_select_sleep_state(component->dev);
+
+	return 0;
+}
+
+/*
  * Called by ALSA when a PCM substream is opened, the runtime->hw record is
  * then initialized and any private data can be allocated. This also calls
  * startup for the cpu DAI, component, machine and codec DAI.
@@ -664,50 +708,6 @@ static void codec2codec_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
 }
 
 /*
- * Called by ALSA when a PCM substream is closed. Private data can be
- * freed here. The cpu DAI, codec DAI, machine and components are also
- * shutdown.
- */
-static int soc_pcm_close(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_component *component;
-	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-	struct snd_soc_dai *codec_dai;
-	int i;
-
-	mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
-
-	snd_soc_runtime_deactivate(rtd, substream->stream);
-
-	snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream);
-
-	snd_soc_dai_shutdown(cpu_dai, substream);
-
-	for_each_rtd_codec_dai(rtd, i, codec_dai)
-		snd_soc_dai_shutdown(codec_dai, substream);
-
-	soc_rtd_shutdown(rtd, substream);
-
-	soc_pcm_components_close(substream);
-
-	snd_soc_dapm_stream_stop(rtd, substream->stream);
-
-	mutex_unlock(&rtd->card->pcm_mutex);
-
-	for_each_rtd_components(rtd, i, component) {
-		pm_runtime_mark_last_busy(component->dev);
-		pm_runtime_put_autosuspend(component->dev);
-	}
-
-	for_each_rtd_components(rtd, i, component)
-		if (!component->active)
-			pinctrl_pm_select_sleep_state(component->dev);
-
-	return 0;
-}
-
-/*
  * Called by ALSA when the PCM substream is prepared, can set format, sample
  * rate, etc.  This function is non atomic and can be called multiple times,
  * it can refer to the runtime info.
-- 
2.7.4

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

  parent reply	other threads:[~2020-02-10  3:19 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10  3:13 [alsa-devel] [PATCH v3 0/7] ASoC: soc-pcm cleanup step2 Kuninori Morimoto
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 1/8] ASoC: soc-pcm: add snd_soc_runtime_action() Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: add snd_soc_runtime_action()" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 2/8] ASoC: soc-pcm: adjustment for DAI member 0 reset Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: adjustment for DAI member 0 reset" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 3/8] ASoC: soc-pcm: add for_each_dapm_widgets() macro Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: add for_each_dapm_widgets() macro" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 4/8] ASoC: soc-pcm: don't use bit-OR'ed error Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: don't use bit-OR'ed error" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 5/8] ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once" to the asoc tree Mark Brown
2020-03-27 18:16   ` [alsa-devel] [PATCH v3 5/8] ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once Amadeusz Sławiński
2020-03-27 18:38     ` Pierre-Louis Bossart
2020-03-30  1:10       ` Kuninori Morimoto
2020-03-30  7:25         ` Amadeusz Sławiński
2020-03-30 11:08           ` Mark Brown
2020-03-30 23:28             ` Kuninori Morimoto
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 6/8] ASoC: soc-pcm: call snd_soc_component_open/close() once Kuninori Morimoto
2020-02-10 14:41   ` Pierre-Louis Bossart
2020-02-11 12:16     ` Mark Brown
2020-02-12  0:32       ` Kuninori Morimoto
2020-02-12  1:16         ` Kuninori Morimoto
2020-02-12 15:26           ` Pierre-Louis Bossart
2020-02-12 23:57   ` [alsa-devel] Applied "ASoC: soc-pcm: call snd_soc_component_open/close() once" to the asoc tree Mark Brown
2020-02-10  3:14 ` Kuninori Morimoto [this message]
2020-02-12 23:57   ` [alsa-devel] Applied "ASoC: soc-pcm: move soc_pcm_close() next to soc_pcm_open()" " Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 8/8] ASoC: soc-pcm: tidyup soc_pcm_open() order Kuninori Morimoto
2020-02-12 23:57   ` [alsa-devel] Applied "ASoC: soc-pcm: tidyup soc_pcm_open() order" to the asoc tree Mark Brown
     [not found] ` <87d0anceze.wl-kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2020-02-18 19:14   ` [alsa-devel] [PATCH v3 0/7] ASoC: soc-pcm cleanup step2 Dmitry Osipenko
2020-02-18 19:14     ` Dmitry Osipenko
     [not found]     ` <5d19876d-86a4-a461-f47a-68c7ba1f46ac-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-02-19  1:30       ` Kuninori Morimoto
2020-02-19  1:30         ` Kuninori Morimoto
2020-02-19 16:09       ` Pierre-Louis Bossart
2020-02-19 16:09         ` Pierre-Louis Bossart
     [not found]         ` <d60ccad5-9c52-551b-ae22-2815ab768a59-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2020-02-19 17:01           ` Kai Vehmanen
2020-02-19 17:01             ` Kai Vehmanen
     [not found]             ` <alpine.DEB.2.21.2002191900170.2957-cz35TXaqH4VICrp9aNEsHNh3ngVCH38I@public.gmane.org>
2020-02-19 17:03               ` Mark Brown
2020-02-19 17:03                 ` Mark Brown

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=8736bjcexx.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.