ASoC: davinci: Use snd_pcm_stop_xrun() helper
authorTakashi Iwai <tiwai@suse.de>
Wed, 4 Jul 2018 14:01:43 +0000 (16:01 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 4 Jul 2018 14:41:33 +0000 (15:41 +0100)
Replace open-codes with the standard snd_pcm_stop_xrun() helper.
It simplifies codes a lot.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/davinci/davinci-mcasp.c

index 47c0c821d325f4b14b50b16b8fb9043c06670861..f70db8412c7ccb17915b7cf914677d2e1da24f70 100644 (file)
@@ -320,12 +320,8 @@ static irqreturn_t davinci_mcasp_tx_irq_handler(int irq, void *data)
                handled_mask |= XUNDRN;
 
                substream = mcasp->substreams[SNDRV_PCM_STREAM_PLAYBACK];
-               if (substream) {
-                       snd_pcm_stream_lock_irq(substream);
-                       if (snd_pcm_running(substream))
-                               snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
-                       snd_pcm_stream_unlock_irq(substream);
-               }
+               if (substream)
+                       snd_pcm_stop_xrun(substream);
        }
 
        if (!handled_mask)
@@ -355,12 +351,8 @@ static irqreturn_t davinci_mcasp_rx_irq_handler(int irq, void *data)
                handled_mask |= ROVRN;
 
                substream = mcasp->substreams[SNDRV_PCM_STREAM_CAPTURE];
-               if (substream) {
-                       snd_pcm_stream_lock_irq(substream);
-                       if (snd_pcm_running(substream))
-                               snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
-                       snd_pcm_stream_unlock_irq(substream);
-               }
+               if (substream)
+                       snd_pcm_stop_xrun(substream);
        }
 
        if (!handled_mask)