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: [PATCH v3 01/21] ASoC: soc-pcm: replace snd_soc_runtime_activate()/deactivate() to macro
Date: 15 May 2020 09:46:21 +0900	[thread overview]
Message-ID: <87blmq6n4y.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87d0766n64.wl-kuninori.morimoto.gx@renesas.com>

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

snd_soc_runtime_activate()/deactivate() are implemented by global function
which are just calling snd_soc_runtime_action().
We can replace it to macro, and this patch do it.
This patch is prepare for xxx_active cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 include/sound/soc.h | 15 ++++++++++++--
 sound/soc/soc-pcm.c | 49 ++++++++++++++-------------------------------
 2 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 69a82487fa9b..a7fa64260108 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -468,8 +468,19 @@ struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
 				struct snd_soc_dai_link *dai_link);
 
 bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd);
-void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream);
-void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream);
+
+void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
+			    int stream, int action);
+static inline void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd,
+				     int stream)
+{
+	snd_soc_runtime_action(rtd, stream, 1);
+}
+static inline void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd,
+				       int stream)
+{
+	snd_soc_runtime_action(rtd, stream, -1);
+}
 
 int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
 			    struct snd_pcm_hardware *hw, int stream);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 440c7e87829a..e7175afd9a73 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -256,8 +256,20 @@ static int soc_rtd_trigger(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
-static void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
-				   int stream, int action)
+/**
+ * snd_soc_runtime_action() - Increment/Decrement active count for
+ * PCM runtime components
+ * @rtd: ASoC PCM runtime that is activated
+ * @stream: Direction of the PCM stream
+ *
+ * Increments/Decrements the active count for all the DAIs and components
+ * attached to a PCM runtime.
+ * Should typically be called when a stream is opened.
+ *
+ * Must be called with the rtd->card->pcm_mutex being held
+ */
+void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
+			    int stream, int action)
 {
 	struct snd_soc_dai *dai;
 	int i;
@@ -270,38 +282,7 @@ static void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
 		dai->component->active += action;
 	}
 }
-
-/**
- * snd_soc_runtime_activate() - Increment active count for PCM runtime components
- * @rtd: ASoC PCM runtime that is activated
- * @stream: Direction of the PCM stream
- *
- * Increments the active count for all the DAIs and components attached to a PCM
- * runtime. Should typically be called when a stream is opened.
- *
- * Must be called with the rtd->card->pcm_mutex being held
- */
-void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream)
-{
-	snd_soc_runtime_action(rtd, stream, 1);
-}
-EXPORT_SYMBOL_GPL(snd_soc_runtime_activate);
-
-/**
- * snd_soc_runtime_deactivate() - Decrement active count for PCM runtime components
- * @rtd: ASoC PCM runtime that is deactivated
- * @stream: Direction of the PCM stream
- *
- * Decrements the active count for all the DAIs and components attached to a PCM
- * runtime. Should typically be called when a stream is closed.
- *
- * Must be called with the rtd->card->pcm_mutex being held
- */
-void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream)
-{
-	snd_soc_runtime_action(rtd, stream, -1);
-}
-EXPORT_SYMBOL_GPL(snd_soc_runtime_deactivate);
+EXPORT_SYMBOL_GPL(snd_soc_runtime_action);
 
 /**
  * snd_soc_runtime_ignore_pmdown_time() - Check whether to ignore the power down delay
-- 
2.17.1


  reply	other threads:[~2020-05-15  0:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  0:45 [PATCH v3 00/21] ASoC: cleanup DAI/Component activity Kuninori Morimoto
2020-05-15  0:46 ` Kuninori Morimoto [this message]
2020-05-15  0:46 ` [PATCH v3 02/21] ASoC: soc-dai: add snd_soc_dai_action() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 03/21] ASoC: soc-dapm: use snd_soc_dai_activate()/deactivate() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 04/21] ASoC: soc-dai: add snd_soc_dai_active() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 05/21] ASoC: soc-component: add snd_soc_component_active() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 06/21] ASoC: soc-dai: add snd_soc_dai_stream_active() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 07/21] ASoC: use snd_soc_xxx_active() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 08/21] ASoC: atomel: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 09/21] ASoC: bcm: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 10/21] ASoC: cirrus: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 11/21] ASoC: codecs: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 12/21] ASoC: fsl: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 13/21] ASoC: intel: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 14/21] ASoC: jz4740: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 15/21] ASoC: mediatek: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 16/21] ASoC: meson: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 17/21] ASoC: pxa: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 18/21] ASoC: ti: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 19/21] ASoC: uniphier: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 20/21] ASoC: dwc: " Kuninori Morimoto
2020-05-15  0:48 ` [PATCH v3 21/21] ASoC: cleanup dai / component active code Kuninori Morimoto
2020-05-18 16:41 ` [PATCH v3 00/21] ASoC: cleanup DAI/Component activity 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=87blmq6n4y.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.