V4L/DVB (10520): em28xx-audio: Add spinlock for trigger
authorDouglas Schilling Landgraf <dougsland@redhat.com>
Sun, 8 Feb 2009 17:17:15 +0000 (14:17 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:44 +0000 (12:42 -0300)
Added spinlock for trigger session

Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/em28xx-audio.c

index 52c6657d61cf043cffc13f4970324833f14042f4..8e9957dbdbec8434c6fc75c0309c775a511f7a6d 100644 (file)
@@ -381,19 +381,27 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream,
                                      int cmd)
 {
        struct em28xx *dev = snd_pcm_substream_chip(substream);
+       int retval;
 
        dprintk("Should %s capture\n", (cmd == SNDRV_PCM_TRIGGER_START)?
                                       "start": "stop");
+
+       spin_lock(&dev->adev.slock);
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
                em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1);
-               return 0;
+               retval = 0;
+               break;
        case SNDRV_PCM_TRIGGER_STOP:
                em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0);
-               return 0;
+               retval = 0;
+               break;
        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