Commit a9faca15 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-pcm: remove dpcm_do_trigger()

dpcm_be_dai_trigger() is calling dpcm_do_trigger()
at each SNDRV_PCM_TRIGGER_xxx (1).

	int dpcm_be_dai_trigger(...)
	{
		for_each_dpcm_be(fe, stream, dpcm) {
(B)			...
			switch (cmd) {
			case SNDRV_PCM_TRIGGER_START:
				...
(1)				ret = dpcm_do_trigger(...);
				...
			case SNDRV_PCM_TRIGGER_RESUME:
				...
(1)				ret = dpcm_do_trigger(...);
				...
			case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
				...
(1)				ret = dpcm_do_trigger(...);
				...
			case SNDRV_PCM_TRIGGER_STOP:
				...
(1)				ret = dpcm_do_trigger(...);
				...
			case SNDRV_PCM_TRIGGER_SUSPEND:
				...
(1)				ret = dpcm_do_trigger(...);
				...
			case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
				...
(1)				ret = dpcm_do_trigger(...);
				...
			}
		}
	}

But it is just very verbose and duplicated function.
Because We can indicate dev_dbg() (A) at dpcm_be_dai_trigger() (B).
And dev_err() (C) is not needed because soc_pcm_trigger() itself
indicates error message when error.

	static int dpcm_do_trigger(...)
	{
		int ret;

(A)		dev_dbg(...);

		ret = soc_pcm_trigger(substream, cmd);
		if (ret < 0)
(C)			dev_err(...);

		return ret;
	}

This patch replace dpcm_do_trigger() to soc_pcm_trigger().
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blfecssk.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 474e3abb
...@@ -2050,21 +2050,6 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -2050,21 +2050,6 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
} }
static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm,
struct snd_pcm_substream *substream, int cmd)
{
int ret;
dev_dbg(dpcm->be->dev, "ASoC: trigger BE %s cmd %d\n",
dpcm->be->dai_link->name, cmd);
ret = soc_pcm_trigger(substream, cmd);
if (ret < 0)
dev_err(dpcm->be->dev,"ASoC: trigger BE failed %d\n", ret);
return ret;
}
int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
int cmd) int cmd)
{ {
...@@ -2081,6 +2066,9 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2081,6 +2066,9 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if (!snd_soc_dpcm_be_can_update(fe, be, stream)) if (!snd_soc_dpcm_be_can_update(fe, be, stream))
continue; continue;
dev_dbg(be->dev, "ASoC: trigger BE %s cmd %d\n",
be->dai_link->name, cmd);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
...@@ -2088,7 +2076,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2088,7 +2076,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
continue; continue;
ret = dpcm_do_trigger(dpcm, be_substream, cmd); ret = soc_pcm_trigger(be_substream, cmd);
if (ret) if (ret)
return ret; return ret;
...@@ -2098,7 +2086,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2098,7 +2086,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND))
continue; continue;
ret = dpcm_do_trigger(dpcm, be_substream, cmd); ret = soc_pcm_trigger(be_substream, cmd);
if (ret) if (ret)
return ret; return ret;
...@@ -2108,7 +2096,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2108,7 +2096,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
continue; continue;
ret = dpcm_do_trigger(dpcm, be_substream, cmd); ret = soc_pcm_trigger(be_substream, cmd);
if (ret) if (ret)
return ret; return ret;
...@@ -2122,7 +2110,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2122,7 +2110,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
continue; continue;
ret = dpcm_do_trigger(dpcm, be_substream, cmd); ret = soc_pcm_trigger(be_substream, cmd);
if (ret) if (ret)
return ret; return ret;
...@@ -2135,7 +2123,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2135,7 +2123,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
continue; continue;
ret = dpcm_do_trigger(dpcm, be_substream, cmd); ret = soc_pcm_trigger(be_substream, cmd);
if (ret) if (ret)
return ret; return ret;
...@@ -2148,7 +2136,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2148,7 +2136,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
continue; continue;
ret = dpcm_do_trigger(dpcm, be_substream, cmd); ret = soc_pcm_trigger(be_substream, cmd);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment