aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/nm256/nm256.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/nm256/nm256.c')
-rw-r--r--sound/pci/nm256/nm256.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 0d0ff54f0fc6..3a3ba6f547bc 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -32,6 +32,8 @@
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <linux/mutex.h>
36
35#include <sound/core.h> 37#include <sound/core.h>
36#include <sound/info.h> 38#include <sound/info.h>
37#include <sound/control.h> 39#include <sound/control.h>
@@ -235,7 +237,7 @@ struct nm256 {
235 int irq_acks; 237 int irq_acks;
236 irqreturn_t (*interrupt)(int, void *, struct pt_regs *); 238 irqreturn_t (*interrupt)(int, void *, struct pt_regs *);
237 int badintrcount; /* counter to check bogus interrupts */ 239 int badintrcount; /* counter to check bogus interrupts */
238 struct semaphore irq_mutex; 240 struct mutex irq_mutex;
239 241
240 struct nm256_stream streams[2]; 242 struct nm256_stream streams[2];
241 243
@@ -459,32 +461,32 @@ snd_nm256_set_format(struct nm256 *chip, struct nm256_stream *s,
459/* acquire interrupt */ 461/* acquire interrupt */
460static int snd_nm256_acquire_irq(struct nm256 *chip) 462static int snd_nm256_acquire_irq(struct nm256 *chip)
461{ 463{
462 down(&chip->irq_mutex); 464 mutex_lock(&chip->irq_mutex);
463 if (chip->irq < 0) { 465 if (chip->irq < 0) {
464 if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ, 466 if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ,
465 chip->card->driver, chip)) { 467 chip->card->driver, chip)) {
466 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); 468 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq);
467 up(&chip->irq_mutex); 469 mutex_unlock(&chip->irq_mutex);
468 return -EBUSY; 470 return -EBUSY;
469 } 471 }
470 chip->irq = chip->pci->irq; 472 chip->irq = chip->pci->irq;
471 } 473 }
472 chip->irq_acks++; 474 chip->irq_acks++;
473 up(&chip->irq_mutex); 475 mutex_unlock(&chip->irq_mutex);
474 return 0; 476 return 0;
475} 477}
476 478
477/* release interrupt */ 479/* release interrupt */
478static void snd_nm256_release_irq(struct nm256 *chip) 480static void snd_nm256_release_irq(struct nm256 *chip)
479{ 481{
480 down(&chip->irq_mutex); 482 mutex_lock(&chip->irq_mutex);
481 if (chip->irq_acks > 0) 483 if (chip->irq_acks > 0)
482 chip->irq_acks--; 484 chip->irq_acks--;
483 if (chip->irq_acks == 0 && chip->irq >= 0) { 485 if (chip->irq_acks == 0 && chip->irq >= 0) {
484 free_irq(chip->irq, chip); 486 free_irq(chip->irq, chip);
485 chip->irq = -1; 487 chip->irq = -1;
486 } 488 }
487 up(&chip->irq_mutex); 489 mutex_unlock(&chip->irq_mutex);
488} 490}
489 491
490/* 492/*
@@ -1407,7 +1409,7 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1407 chip->use_cache = use_cache; 1409 chip->use_cache = use_cache;
1408 spin_lock_init(&chip->reg_lock); 1410 spin_lock_init(&chip->reg_lock);
1409 chip->irq = -1; 1411 chip->irq = -1;
1410 init_MUTEX(&chip->irq_mutex); 1412 mutex_init(&chip->irq_mutex);
1411 1413
1412 /* store buffer sizes in bytes */ 1414 /* store buffer sizes in bytes */
1413 chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = playback_bufsize * 1024; 1415 chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = playback_bufsize * 1024;