diff options
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index dfb5031969f8..a3d122109704 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1098,6 +1098,29 @@ int snd_pcm_drain_done(struct snd_pcm_substream *substream) | |||
1098 | SNDRV_PCM_STATE_SETUP); | 1098 | SNDRV_PCM_STATE_SETUP); |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | /** | ||
1102 | * snd_pcm_stop_xrun - stop the running streams as XRUN | ||
1103 | * @substream: the PCM substream instance | ||
1104 | * @state: PCM state after stopping the stream | ||
1105 | * | ||
1106 | * This stops the given running substream (and all linked substreams) as XRUN. | ||
1107 | * Unlike snd_pcm_stop(), this function takes the substream lock by itself. | ||
1108 | * | ||
1109 | * Return: Zero if successful, or a negative error code. | ||
1110 | */ | ||
1111 | int snd_pcm_stop_xrun(struct snd_pcm_substream *substream) | ||
1112 | { | ||
1113 | unsigned long flags; | ||
1114 | int ret = 0; | ||
1115 | |||
1116 | snd_pcm_stream_lock_irqsave(substream, flags); | ||
1117 | if (snd_pcm_running(substream)) | ||
1118 | ret = snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | ||
1119 | snd_pcm_stream_unlock_irqrestore(substream, flags); | ||
1120 | return ret; | ||
1121 | } | ||
1122 | EXPORT_SYMBOL_GPL(snd_pcm_stop_xrun); | ||
1123 | |||
1101 | /* | 1124 | /* |
1102 | * pause callbacks | 1125 | * pause callbacks |
1103 | */ | 1126 | */ |