aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index c9476c237c42..53009bb642f6 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -47,6 +47,7 @@
47#include <linux/usb.h> 47#include <linux/usb.h>
48#include <linux/vmalloc.h> 48#include <linux/vmalloc.h>
49#include <linux/moduleparam.h> 49#include <linux/moduleparam.h>
50#include <linux/mutex.h>
50#include <sound/core.h> 51#include <sound/core.h>
51#include <sound/info.h> 52#include <sound/info.h>
52#include <sound/pcm.h> 53#include <sound/pcm.h>
@@ -202,7 +203,7 @@ struct snd_usb_stream {
202 * the all interfaces on the same card as one sound device. 203 * the all interfaces on the same card as one sound device.
203 */ 204 */
204 205
205static DECLARE_MUTEX(register_mutex); 206static DEFINE_MUTEX(register_mutex);
206static struct snd_usb_audio *usb_chip[SNDRV_CARDS]; 207static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
207 208
208 209
@@ -3285,7 +3286,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3285 3286
3286 /* check whether it's already registered */ 3287 /* check whether it's already registered */
3287 chip = NULL; 3288 chip = NULL;
3288 down(&register_mutex); 3289 mutex_lock(&register_mutex);
3289 for (i = 0; i < SNDRV_CARDS; i++) { 3290 for (i = 0; i < SNDRV_CARDS; i++) {
3290 if (usb_chip[i] && usb_chip[i]->dev == dev) { 3291 if (usb_chip[i] && usb_chip[i]->dev == dev) {
3291 if (usb_chip[i]->shutdown) { 3292 if (usb_chip[i]->shutdown) {
@@ -3338,13 +3339,13 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3338 3339
3339 usb_chip[chip->index] = chip; 3340 usb_chip[chip->index] = chip;
3340 chip->num_interfaces++; 3341 chip->num_interfaces++;
3341 up(&register_mutex); 3342 mutex_unlock(&register_mutex);
3342 return chip; 3343 return chip;
3343 3344
3344 __error: 3345 __error:
3345 if (chip && !chip->num_interfaces) 3346 if (chip && !chip->num_interfaces)
3346 snd_card_free(chip->card); 3347 snd_card_free(chip->card);
3347 up(&register_mutex); 3348 mutex_unlock(&register_mutex);
3348 __err_val: 3349 __err_val:
3349 return NULL; 3350 return NULL;
3350} 3351}
@@ -3364,7 +3365,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
3364 3365
3365 chip = ptr; 3366 chip = ptr;
3366 card = chip->card; 3367 card = chip->card;
3367 down(&register_mutex); 3368 mutex_lock(&register_mutex);
3368 chip->shutdown = 1; 3369 chip->shutdown = 1;
3369 chip->num_interfaces--; 3370 chip->num_interfaces--;
3370 if (chip->num_interfaces <= 0) { 3371 if (chip->num_interfaces <= 0) {
@@ -3382,10 +3383,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
3382 snd_usb_mixer_disconnect(p); 3383 snd_usb_mixer_disconnect(p);
3383 } 3384 }
3384 usb_chip[chip->index] = NULL; 3385 usb_chip[chip->index] = NULL;
3385 up(&register_mutex); 3386 mutex_unlock(&register_mutex);
3386 snd_card_free(card); 3387 snd_card_free(card);
3387 } else { 3388 } else {
3388 up(&register_mutex); 3389 mutex_unlock(&register_mutex);
3389 } 3390 }
3390} 3391}
3391 3392