aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/pcxhr/pcxhr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/pcxhr/pcxhr.c')
-rw-r--r--sound/pci/pcxhr/pcxhr.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index b2cba75b6b167..f679779d96e3b 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -26,8 +26,11 @@
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/pci.h>
+#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/info.h>
@@ -518,7 +521,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
struct timeval my_tv1, my_tv2;
do_gettimeofday(&my_tv1);
#endif
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
/* check the pipes concerned and build pipe_array */
for (i = 0; i < mgr->num_cards; i++) {
@@ -537,7 +540,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
}
}
if (capture_mask == 0 && playback_mask == 0) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
snd_printk(KERN_ERR "pcxhr_trigger_tasklet : no pipes\n");
return;
}
@@ -548,7 +551,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
/* synchronous stop of all the pipes concerned */
err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0);
if (err) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error stop pipes (P%x C%x)\n",
playback_mask, capture_mask);
return;
@@ -592,7 +595,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
/* synchronous start of all the pipes concerned */
err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1);
if (err) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error start pipes (P%x C%x)\n",
playback_mask, capture_mask);
return;
@@ -619,7 +622,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
}
spin_unlock_irqrestore(&mgr->lock, flags);
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
#ifdef CONFIG_SND_DEBUG_DETECT
do_gettimeofday(&my_tv2);
@@ -728,7 +731,7 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs)
}
*/
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
do {
/* if the stream was stopped before, format and buffer were reset */
@@ -755,7 +758,7 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs)
}
} while(0); /* do only once (so we can use break instead of goto) */
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -780,7 +783,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs,
/* set up format for the stream */
format = params_format(hw);
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
stream->channels = channels;
stream->format = format;
@@ -789,7 +792,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs,
/*
err = pcxhr_set_format(stream);
if(err) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
*/
@@ -801,7 +804,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs,
err = pcxhr_update_r_buffer(stream);
}
*/
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -847,7 +850,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
struct pcxhr_stream *stream;
int is_capture;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
/* copy the struct snd_pcm_hardware struct */
runtime->hw = pcxhr_caps;
@@ -871,7 +874,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
/* streams in use */
snd_printk(KERN_ERR "pcxhr_open chip%d subs%d in use\n",
chip->chip_idx, subs->number);
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return -EBUSY;
}
@@ -887,7 +890,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
&external_rate) ||
external_rate == 0) {
/* cannot detect the external clock rate */
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return -EBUSY;
}
runtime->hw.rate_min = runtime->hw.rate_max = external_rate;
@@ -905,7 +908,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
mgr->ref_count_rate++;
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return 0;
}
@@ -916,7 +919,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs)
struct pcxhr_mgr *mgr = chip->mgr;
struct pcxhr_stream *stream = subs->runtime->private_data;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
snd_printdd("pcxhr_close chip%d subs%d\n", chip->chip_idx, subs->number);
@@ -929,7 +932,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs)
stream->status = PCXHR_STREAM_STATUS_FREE;
stream->substream = NULL;
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return 0;
}
@@ -1215,7 +1218,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
pci_set_master(pci);
/* check if we can restrict PCI DMA transfers to 32 bits */
- if (pci_set_dma_mask(pci, 0xffffffff) < 0) {
+ if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) {
snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n");
pci_disable_device(pci);
return -ENXIO;
@@ -1264,7 +1267,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
spin_lock_init(&mgr->msg_lock);
/* init setup mutex*/
- init_MUTEX(&mgr->setup_mutex);
+ mutex_init(&mgr->setup_mutex);
/* init taslket */
tasklet_init(&mgr->msg_taskq, pcxhr_msg_tasklet, (unsigned long) mgr);