aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/ad1848/ad1848_lib.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index 31209e11cee5..a901cd1ee692 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -378,11 +378,9 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
378{ 378{
379 unsigned long flags; 379 unsigned long flags;
380 380
381 mutex_lock(&chip->open_mutex); 381 if (chip->mode & AD1848_MODE_OPEN)
382 if (chip->mode & AD1848_MODE_OPEN) {
383 mutex_unlock(&chip->open_mutex);
384 return -EAGAIN; 382 return -EAGAIN;
385 } 383
386 snd_ad1848_mce_down(chip); 384 snd_ad1848_mce_down(chip);
387 385
388#ifdef SNDRV_DEBUG_MCE 386#ifdef SNDRV_DEBUG_MCE
@@ -423,7 +421,6 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
423 spin_unlock_irqrestore(&chip->reg_lock, flags); 421 spin_unlock_irqrestore(&chip->reg_lock, flags);
424 422
425 chip->mode = mode; 423 chip->mode = mode;
426 mutex_unlock(&chip->open_mutex);
427 424
428 return 0; 425 return 0;
429} 426}
@@ -432,11 +429,8 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
432{ 429{
433 unsigned long flags; 430 unsigned long flags;
434 431
435 mutex_lock(&chip->open_mutex); 432 if (!chip->mode)
436 if (!chip->mode) {
437 mutex_unlock(&chip->open_mutex);
438 return; 433 return;
439 }
440 /* disable IRQ */ 434 /* disable IRQ */
441 spin_lock_irqsave(&chip->reg_lock, flags); 435 spin_lock_irqsave(&chip->reg_lock, flags);
442 outb(0, AD1848P(chip, STATUS)); /* clear IRQ */ 436 outb(0, AD1848P(chip, STATUS)); /* clear IRQ */
@@ -462,7 +456,6 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
462 spin_unlock_irqrestore(&chip->reg_lock, flags); 456 spin_unlock_irqrestore(&chip->reg_lock, flags);
463 457
464 chip->mode = 0; 458 chip->mode = 0;
465 mutex_unlock(&chip->open_mutex);
466} 459}
467 460
468/* 461/*
@@ -880,7 +873,6 @@ int snd_ad1848_create(struct snd_card *card,
880 if (chip == NULL) 873 if (chip == NULL)
881 return -ENOMEM; 874 return -ENOMEM;
882 spin_lock_init(&chip->reg_lock); 875 spin_lock_init(&chip->reg_lock);
883 mutex_init(&chip->open_mutex);
884 chip->card = card; 876 chip->card = card;
885 chip->port = port; 877 chip->port = port;
886 chip->irq = -1; 878 chip->irq = -1;