aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/es1968.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/es1968.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/es1968.c')
-rw-r--r--sound/pci/es1968.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 3747a436f0c..6a265ab3894 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -103,6 +103,8 @@
#include <linux/slab.h>
#include <linux/gameport.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/mpu401.h>
@@ -569,7 +571,7 @@ struct es1968 {
u16 maestro_map[32];
int bobclient; /* active timer instancs */
int bob_freq; /* timer frequency */
- struct semaphore memory_mutex; /* memory lock */
+ struct mutex memory_mutex; /* memory lock */
/* APU states */
unsigned char apu[NR_APUS];
@@ -1356,13 +1358,13 @@ static int calc_available_memory_size(struct es1968 *chip)
struct list_head *p;
int max_size = 0;
- down(&chip->memory_mutex);
+ mutex_lock(&chip->memory_mutex);
list_for_each(p, &chip->buf_list) {
struct esm_memory *buf = list_entry(p, struct esm_memory, list);
if (buf->empty && buf->buf.bytes > max_size)
max_size = buf->buf.bytes;
}
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
if (max_size >= 128*1024)
max_size = 127*1024;
return max_size;
@@ -1375,20 +1377,20 @@ static struct esm_memory *snd_es1968_new_memory(struct es1968 *chip, int size)
struct list_head *p;
size = ((size + ESM_MEM_ALIGN - 1) / ESM_MEM_ALIGN) * ESM_MEM_ALIGN;
- down(&chip->memory_mutex);
+ mutex_lock(&chip->memory_mutex);
list_for_each(p, &chip->buf_list) {
buf = list_entry(p, struct esm_memory, list);
if (buf->empty && buf->buf.bytes >= size)
goto __found;
}
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
return NULL;
__found:
if (buf->buf.bytes > size) {
struct esm_memory *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
if (chunk == NULL) {
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
return NULL;
}
chunk->buf = buf->buf;
@@ -1400,7 +1402,7 @@ __found:
list_add(&chunk->list, &buf->list);
}
buf->empty = 0;
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
return buf;
}
@@ -1409,7 +1411,7 @@ static void snd_es1968_free_memory(struct es1968 *chip, struct esm_memory *buf)
{
struct esm_memory *chunk;
- down(&chip->memory_mutex);
+ mutex_lock(&chip->memory_mutex);
buf->empty = 1;
if (buf->list.prev != &chip->buf_list) {
chunk = list_entry(buf->list.prev, struct esm_memory, list);
@@ -1428,7 +1430,7 @@ static void snd_es1968_free_memory(struct es1968 *chip, struct esm_memory *buf)
kfree(chunk);
}
}
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
}
static void snd_es1968_free_dmabuf(struct es1968 *chip)
@@ -2579,7 +2581,7 @@ static int __devinit snd_es1968_create(struct snd_card *card,
INIT_LIST_HEAD(&chip->buf_list);
INIT_LIST_HEAD(&chip->substream_list);
spin_lock_init(&chip->ac97_lock);
- init_MUTEX(&chip->memory_mutex);
+ mutex_init(&chip->memory_mutex);
tasklet_init(&chip->hwvol_tq, es1968_update_hw_volume, (unsigned long)chip);
chip->card = card;
chip->pci = pci;