Revert "ASoC: soc-pcm: test refcount before triggering"

This reverts commit 74201b3c3e which is
commit 848aedfdc6ba25ad5652797db9266007773e44dd upstream.

It is part of a series of ASoC patches that break the Android abi.  If
they are needed in the future they can be brought back in an ABI-safe
way.

Bug: 161946584
Change-Id: I40a69903a9569744aa27bc01bc1a0c6003d7d894
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2023-06-24 10:30:33 +00:00
parent f4dbaebbc0
commit f5a2ab8902
2 changed files with 11 additions and 44 deletions

View File

@@ -101,8 +101,6 @@ struct snd_soc_dpcm_runtime {
enum snd_soc_dpcm_state state;
int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
int be_start; /* refcount protected by BE stream pcm lock */
};
#define for_each_dpcm_fe(be, stream, _dpcm) \

View File

@@ -1639,7 +1639,7 @@ int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
be->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
goto unwind;
}
be->dpcm[stream].be_start = 0;
be->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
count++;
}
@@ -2129,21 +2129,14 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
if (!be->dpcm[stream].be_start &&
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
goto next;
be->dpcm[stream].be_start++;
if (be->dpcm[stream].be_start != 1)
goto next;
ret = soc_pcm_trigger(be_substream, cmd);
if (ret) {
be->dpcm[stream].be_start--;
if (ret)
goto next;
}
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
break;
@@ -2151,15 +2144,9 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND))
goto next;
be->dpcm[stream].be_start++;
if (be->dpcm[stream].be_start != 1)
goto next;
ret = soc_pcm_trigger(be_substream, cmd);
if (ret) {
be->dpcm[stream].be_start--;
if (ret)
goto next;
}
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
break;
@@ -2167,15 +2154,9 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
goto next;
be->dpcm[stream].be_start++;
if (be->dpcm[stream].be_start != 1)
goto next;
ret = soc_pcm_trigger(be_substream, cmd);
if (ret) {
be->dpcm[stream].be_start--;
if (ret)
goto next;
}
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
break;
@@ -2184,18 +2165,12 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
goto next;
if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START)
be->dpcm[stream].be_start--;
if (be->dpcm[stream].be_start != 0)
if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
goto next;
ret = soc_pcm_trigger(be_substream, cmd);
if (ret) {
if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_START)
be->dpcm[stream].be_start++;
if (ret)
goto next;
}
be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP;
break;
@@ -2203,15 +2178,12 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START)
goto next;
be->dpcm[stream].be_start--;
if (be->dpcm[stream].be_start != 0)
if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
goto next;
ret = soc_pcm_trigger(be_substream, cmd);
if (ret) {
be->dpcm[stream].be_start++;
if (ret)
goto next;
}
be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND;
break;
@@ -2219,15 +2191,12 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START)
goto next;
be->dpcm[stream].be_start--;
if (be->dpcm[stream].be_start != 0)
if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
goto next;
ret = soc_pcm_trigger(be_substream, cmd);
if (ret) {
be->dpcm[stream].be_start++;
if (ret)
goto next;
}
be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED;
break;