]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/em28xx/em28xx-audio.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-omap-h63xx.git] / drivers / media / video / em28xx / em28xx-audio.c
index 941357c4f3f56a13fd0d78c46401b0865b770bcf..3c006103c1eb369c4817fd74522ef7ffebc91e61 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/vmalloc.h>
 #include <linux/proc_fs.h>
 #include <linux/module.h>
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -52,7 +51,7 @@ MODULE_PARM_DESC(debug, "activates debug info");
 #define dprintk(fmt, arg...) do {                                      \
            if (debug)                                                  \
                printk(KERN_INFO "em28xx-audio %s: " fmt,               \
-                                 __FUNCTION__, ##arg);                 \
+                                 __func__, ##arg);             \
        } while (0)
 
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
@@ -269,9 +268,18 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
 
        dprintk("opening device and trying to acquire exclusive lock\n");
 
+       if (!dev) {
+               printk(KERN_ERR "BUG: em28xx can't find device struct."
+                               " Can't proceed with open\n");
+               return -ENODEV;
+       }
+
        /* Sets volume, mute, etc */
+
        dev->mute = 0;
+       mutex_lock(&dev->lock);
        ret = em28xx_audio_analog_set(dev);
+       mutex_unlock(&dev->lock);
        if (ret < 0)
                goto err;
 
@@ -303,7 +311,9 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream)
        dprintk("closing device\n");
 
        dev->mute = 1;
+       mutex_lock(&dev->lock);
        em28xx_audio_analog_set(dev);
+       mutex_unlock(&dev->lock);
 
        if (dev->adev->users == 0 && dev->adev->shutdown == 1) {
                dprintk("audio users: %d\n", dev->adev->users);
@@ -411,6 +421,12 @@ static int em28xx_audio_init(struct em28xx *dev)
        static int          devnr;
        int                 ret, err;
 
+       if (dev->has_audio_class) {
+               /* This device does not support the extension (in this case
+                  the device is expecting the snd-usb-audio module */
+               return 0;
+       }
+
        printk(KERN_INFO "em28xx-audio.c: probing for em28x1 "
                         "non standard usbaudio\n");
        printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
@@ -454,6 +470,12 @@ static int em28xx_audio_fini(struct em28xx *dev)
        if (dev == NULL)
                return 0;
 
+       if (dev->has_audio_class) {
+               /* This device does not support the extension (in this case
+                  the device is expecting the snd-usb-audio module */
+               return 0;
+       }
+
        if (dev->adev) {
                snd_card_free(dev->adev->sndcard);
                kfree(dev->adev);