Commit df39ca64 authored by Douglas Schilling Landgraf's avatar Douglas Schilling Landgraf Committed by Mauro Carvalho Chehab

V4L/DVB (10520): em28xx-audio: Add spinlock for trigger

Added spinlock for trigger session
Signed-off-by: default avatarDouglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c744dff2
...@@ -381,19 +381,27 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, ...@@ -381,19 +381,27 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream,
int cmd) int cmd)
{ {
struct em28xx *dev = snd_pcm_substream_chip(substream); struct em28xx *dev = snd_pcm_substream_chip(substream);
int retval;
dprintk("Should %s capture\n", (cmd == SNDRV_PCM_TRIGGER_START)? dprintk("Should %s capture\n", (cmd == SNDRV_PCM_TRIGGER_START)?
"start": "stop"); "start": "stop");
spin_lock(&dev->adev.slock);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1); em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1);
return 0; retval = 0;
break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0);
return 0; retval = 0;
break;
default: default:
return -EINVAL; retval = -EINVAL;
} }
spin_unlock(&dev->adev.slock);
return retval;
} }
static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream
......
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