aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b3f37e7b33c0..dbed2644a192 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -43,6 +43,7 @@
43#include <linux/init.h> 43#include <linux/init.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/pci.h> 45#include <linux/pci.h>
46#include <linux/mutex.h>
46#include <sound/core.h> 47#include <sound/core.h>
47#include <sound/initval.h> 48#include <sound/initval.h>
48#include "hda_codec.h" 49#include "hda_codec.h"
@@ -297,7 +298,7 @@ struct azx {
297 298
298 /* locks */ 299 /* locks */
299 spinlock_t reg_lock; 300 spinlock_t reg_lock;
300 struct semaphore open_mutex; 301 struct mutex open_mutex;
301 302
302 /* streams (x num_streams) */ 303 /* streams (x num_streams) */
303 struct azx_dev *azx_dev; 304 struct azx_dev *azx_dev;
@@ -993,10 +994,10 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
993 unsigned long flags; 994 unsigned long flags;
994 int err; 995 int err;
995 996
996 down(&chip->open_mutex); 997 mutex_lock(&chip->open_mutex);
997 azx_dev = azx_assign_device(chip, substream->stream); 998 azx_dev = azx_assign_device(chip, substream->stream);
998 if (azx_dev == NULL) { 999 if (azx_dev == NULL) {
999 up(&chip->open_mutex); 1000 mutex_unlock(&chip->open_mutex);
1000 return -EBUSY; 1001 return -EBUSY;
1001 } 1002 }
1002 runtime->hw = azx_pcm_hw; 1003 runtime->hw = azx_pcm_hw;
@@ -1008,7 +1009,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1008 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 1009 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
1009 if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { 1010 if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) {
1010 azx_release_device(azx_dev); 1011 azx_release_device(azx_dev);
1011 up(&chip->open_mutex); 1012 mutex_unlock(&chip->open_mutex);
1012 return err; 1013 return err;
1013 } 1014 }
1014 spin_lock_irqsave(&chip->reg_lock, flags); 1015 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -1017,7 +1018,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1017 spin_unlock_irqrestore(&chip->reg_lock, flags); 1018 spin_unlock_irqrestore(&chip->reg_lock, flags);
1018 1019
1019 runtime->private_data = azx_dev; 1020 runtime->private_data = azx_dev;
1020 up(&chip->open_mutex); 1021 mutex_unlock(&chip->open_mutex);
1021 return 0; 1022 return 0;
1022} 1023}
1023 1024
@@ -1029,14 +1030,14 @@ static int azx_pcm_close(struct snd_pcm_substream *substream)
1029 struct azx_dev *azx_dev = get_azx_dev(substream); 1030 struct azx_dev *azx_dev = get_azx_dev(substream);
1030 unsigned long flags; 1031 unsigned long flags;
1031 1032
1032 down(&chip->open_mutex); 1033 mutex_lock(&chip->open_mutex);
1033 spin_lock_irqsave(&chip->reg_lock, flags); 1034 spin_lock_irqsave(&chip->reg_lock, flags);
1034 azx_dev->substream = NULL; 1035 azx_dev->substream = NULL;
1035 azx_dev->running = 0; 1036 azx_dev->running = 0;
1036 spin_unlock_irqrestore(&chip->reg_lock, flags); 1037 spin_unlock_irqrestore(&chip->reg_lock, flags);
1037 azx_release_device(azx_dev); 1038 azx_release_device(azx_dev);
1038 hinfo->ops.close(hinfo, apcm->codec, substream); 1039 hinfo->ops.close(hinfo, apcm->codec, substream);
1039 up(&chip->open_mutex); 1040 mutex_unlock(&chip->open_mutex);
1040 return 0; 1041 return 0;
1041} 1042}
1042 1043
@@ -1408,7 +1409,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1408 } 1409 }
1409 1410
1410 spin_lock_init(&chip->reg_lock); 1411 spin_lock_init(&chip->reg_lock);
1411 init_MUTEX(&chip->open_mutex); 1412 mutex_init(&chip->open_mutex);
1412 chip->card = card; 1413 chip->card = card;
1413 chip->pci = pci; 1414 chip->pci = pci;
1414 chip->irq = -1; 1415 chip->irq = -1;