summaryrefslogtreecommitdiff
path: root/sound/pci/ens1370.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-16 16:34:20 +0100
committerJaroslav Kysela <perex@suse.cz>2006-03-22 10:25:29 +0100
commit62932df8fb20ba2fb53a95fa52445eba22e821fe (patch)
tree335178d7438395a68a453a9c23624b3e9fc5ec40 /sound/pci/ens1370.c
parent8b7547f95cbe8a5940df62ed730646fdfcba5fda (diff)
[ALSA] semaphore -> mutex (PCI part)
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ens1370.c')
-rw-r--r--sound/pci/ens1370.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index bee382995fe9..a5533c86b0b6 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -35,6 +35,8 @@
#include <linux/slab.h>
#include <linux/gameport.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/control.h>
#include <sound/pcm.h>
@@ -379,7 +381,7 @@ MODULE_PARM_DESC(lineio, "Line In to Rear Out (0 = auto, 1 = force).");
struct ensoniq {
spinlock_t reg_lock;
- struct semaphore src_mutex;
+ struct mutex src_mutex;
int irq;
@@ -609,7 +611,7 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
struct ensoniq *ensoniq = ac97->private_data;
unsigned int t, x;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
for (t = 0; t < POLL_COUNT; t++) {
if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
/* save the current state for latter */
@@ -634,11 +636,11 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
/* restore SRC reg */
snd_es1371_wait_src_ready(ensoniq);
outl(x, ES_REG(ensoniq, 1371_SMPRATE));
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
return;
}
}
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n",
ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
}
@@ -650,7 +652,7 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
unsigned int t, x, fail = 0;
__again:
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
for (t = 0; t < POLL_COUNT; t++) {
if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
/* save the current state for latter */
@@ -683,11 +685,11 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
/* now wait for the stinkin' data (RDY) */
for (t = 0; t < POLL_COUNT; t++) {
if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) {
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
return ES_1371_CODEC_READ(x);
}
}
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
if (++fail > 10) {
snd_printk(KERN_ERR "codec read timeout (final) "
"at 0x%lx, reg = 0x%x [0x%x]\n",
@@ -698,7 +700,7 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
goto __again;
}
}
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n",
ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
return 0;
@@ -717,7 +719,7 @@ static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int n, truncm, freq, result;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
n = rate / 3000;
if ((1 << n) & ((1 << 15) | (1 << 13) | (1 << 11) | (1 << 9)))
n--;
@@ -742,14 +744,14 @@ static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate)
snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff);
snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8);
snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8);
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
}
static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int freq, r;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
freq = ((rate << 15) + 1500) / 3000;
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P2 | ES_1371_DIS_R1)) |
@@ -763,14 +765,14 @@ static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate)
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P2 | ES_1371_DIS_R1));
outl(r, ES_REG(ensoniq, 1371_SMPRATE));
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
}
static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int freq, r;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
freq = ((rate << 15) + 1500) / 3000;
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P1 | ES_1371_DIS_R1)) |
@@ -785,7 +787,7 @@ static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate)
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P1 | ES_1371_DIS_R1));
outl(r, ES_REG(ensoniq, 1371_SMPRATE));
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
}
#endif /* CHIP1371 */
@@ -2123,7 +2125,7 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
return -ENOMEM;
}
spin_lock_init(&ensoniq->reg_lock);
- init_MUTEX(&ensoniq->src_mutex);
+ mutex_init(&ensoniq->src_mutex);
ensoniq->card = card;
ensoniq->pci = pci;
ensoniq->irq = -1;