aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-10-16 08:54:14 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:51:26 -0400
commitca2df45a072cef11143f9be8d36c3c256cbebd7b (patch)
treec9a5cfb7eae7f734abe4ebf24ebf014e31ea9572
parentc2cbdbb1583830b77f169a717407f035d6627793 (diff)
[ALSA] This patch removes open_mutex from the ad1848-lib as
open and close operations are called only from pcm layer and mutexed there with pcm->open_mutex. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--include/sound/ad1848.h1
-rw-r--r--sound/isa/ad1848/ad1848_lib.c14
2 files changed, 3 insertions, 12 deletions
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index b00eb61620b8..d04f9e78c7c1 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -154,7 +154,6 @@ struct snd_ad1848 {
154#endif 154#endif
155 155
156 spinlock_t reg_lock; 156 spinlock_t reg_lock;
157 struct mutex open_mutex;
158}; 157};
159 158
160/* exported functions */ 159/* exported functions */
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;