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 4/5] ASoC: soc-pcm: add dpcm_runtime_setup()
Date: 22 Feb 2021 09:47:34 +0900	[thread overview]
Message-ID: <87o8gdvsgr.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: 87tuq5vsin.wl-kuninori.morimoto.gx@renesas.com


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

dpcm_fe_dai_startup() (= A) calls dpcm_set_fe_runtime() (= B) to setup
DPCM runtime. From *naming point of view*, it sounds like setup function
for FE.

(A)	static int dpcm_fe_dai_startup(...)
	{
		...
(B)		dpcm_set_fe_runtime(...);
		...
	}

But in dpcm_set_fe_runtime() (= B),
It  setups FE by dpcm_runtime_setup_fe() (= X),
and setups BE by dpcm_runtime_merge_xxx() (= Y).

(B)	static void dpcm_set_fe_runtime(...)
	{
		...
(X)		dpcm_runtime_setup_fe(...);

 ^		dpcm_runtime_merge_format(...);
(Y)		dpcm_runtime_merge_chan(...);
 v		dpcm_runtime_merge_rate(...);
	}

These means that the function which is called as xxx_fe_xxx()
is setups both FE and BE. This is confusable and can be hot bed for bug.

This patch renames unclear dpcm_runtime_merge_xxx() (= Y) to
more clear dpcm_runtime_setup_be_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 066218f1f075..7fc7e3e24444 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1556,10 +1556,10 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
 
 }
 
-static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
-				      struct snd_pcm_runtime *runtime)
+static void dpcm_runtime_setup_be_format(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct snd_pcm_hardware *hw = &runtime->hw;
 	struct snd_soc_dpcm *dpcm;
 	struct snd_soc_dai *dai;
@@ -1593,10 +1593,10 @@ static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
 	}
 }
 
-static void dpcm_runtime_merge_chan(struct snd_pcm_substream *substream,
-				    struct snd_pcm_runtime *runtime)
+static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct snd_pcm_hardware *hw = &runtime->hw;
 	struct snd_soc_dpcm *dpcm;
 	int stream = substream->stream;
@@ -1641,10 +1641,10 @@ static void dpcm_runtime_merge_chan(struct snd_pcm_substream *substream,
 	}
 }
 
-static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
-				    struct snd_pcm_runtime *runtime)
+static void dpcm_runtime_setup_be_rate(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct snd_pcm_hardware *hw = &runtime->hw;
 	struct snd_soc_dpcm *dpcm;
 	int stream = substream->stream;
@@ -1680,13 +1680,11 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
 
 static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
 {
-	struct snd_pcm_runtime *runtime = substream->runtime;
-
 	dpcm_runtime_setup_fe(substream);
 
-	dpcm_runtime_merge_format(substream, runtime);
-	dpcm_runtime_merge_chan(substream, runtime);
-	dpcm_runtime_merge_rate(substream, runtime);
+	dpcm_runtime_setup_be_format(substream);
+	dpcm_runtime_setup_be_chan(substream);
+	dpcm_runtime_setup_be_rate(substream);
 }
 
 static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
-- 
2.25.1


  parent reply	other threads:[~2021-02-22  0:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  0:46 [PATCH 0/5] soc-pcm: tidyup snd_pcm_hardware setup for FE/BE Kuninori Morimoto
2021-02-22  0:46 ` [PATCH 1/5] ASoC: soc-pcm: remove strange format storing Kuninori Morimoto
2021-02-22  0:47 ` [PATCH 2/5] ASoC: soc-pcm: unpack dpcm_init_runtime_hw() Kuninori Morimoto
2021-02-22  0:47 ` [PATCH 3/5] ASoC: soc-pcm: add dpcm_runtime_setup_fe() Kuninori Morimoto
2021-02-22  0:47 ` Kuninori Morimoto [this message]
2021-02-22  0:47 ` [PATCH 5/5] ASoC: soc-pcm: unpack dpcm_set_fe_runtime() Kuninori Morimoto
2021-03-01 23:34 ` [PATCH 0/5] soc-pcm: tidyup snd_pcm_hardware setup for FE/BE 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=87o8gdvsgr.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.