summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-16 16:33:08 +0100
committerJaroslav Kysela <perex@suse.cz>2006-03-22 10:25:03 +0100
commit8b7547f95cbe8a5940df62ed730646fdfcba5fda (patch)
tree704102a2b9eaef96cf8b96c46e9e48855de64ea3
parentef9f0a42db987e7e2df72289fb4522d24027786b (diff)
downloadlinux-3.10-8b7547f95cbe8a5940df62ed730646fdfcba5fda.tar.gz
linux-3.10-8b7547f95cbe8a5940df62ed730646fdfcba5fda.tar.bz2
linux-3.10-8b7547f95cbe8a5940df62ed730646fdfcba5fda.zip
[ALSA] semaphore -> mutex (ISA 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>
-rw-r--r--include/sound/ad1848.h2
-rw-r--r--include/sound/cs4231.h4
-rw-r--r--include/sound/gus.h6
-rw-r--r--include/sound/sb16_csp.h2
-rw-r--r--sound/isa/ad1848/ad1848_lib.c14
-rw-r--r--sound/isa/cs423x/cs4231_lib.c30
-rw-r--r--sound/isa/cs423x/cs4236_lib.c4
-rw-r--r--sound/isa/gus/gus_dma.c10
-rw-r--r--sound/isa/gus/gus_main.c2
-rw-r--r--sound/isa/gus/gus_mem.c14
-rw-r--r--sound/isa/gus/gus_synth.c14
-rw-r--r--sound/isa/sb/sb16_csp.c12
12 files changed, 57 insertions, 57 deletions
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index 1a2759f3a29..57af1fe7b30 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -154,7 +154,7 @@ struct snd_ad1848 {
#endif
spinlock_t reg_lock;
- struct semaphore open_mutex;
+ struct mutex open_mutex;
};
/* exported functions */
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h
index ac6a5d88208..60b5b92a131 100644
--- a/include/sound/cs4231.h
+++ b/include/sound/cs4231.h
@@ -248,8 +248,8 @@ struct snd_cs4231 {
unsigned int c_dma_size;
spinlock_t reg_lock;
- struct semaphore mce_mutex;
- struct semaphore open_mutex;
+ struct mutex mce_mutex;
+ struct mutex open_mutex;
int (*rate_constraint) (struct snd_pcm_runtime *runtime);
void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
diff --git a/include/sound/gus.h b/include/sound/gus.h
index 63da50fae77..68a664ab97f 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -209,7 +209,7 @@ struct snd_gf1_mem {
struct snd_gf1_bank_info banks_16[4];
struct snd_gf1_mem_block *first;
struct snd_gf1_mem_block *last;
- struct semaphore memory_mutex;
+ struct mutex memory_mutex;
};
struct snd_gf1_dma_block {
@@ -467,8 +467,8 @@ struct snd_gus_card {
spinlock_t dma_lock;
spinlock_t pcm_volume_level_lock;
spinlock_t uart_cmd_lock;
- struct semaphore dma_mutex;
- struct semaphore register_mutex;
+ struct mutex dma_mutex;
+ struct mutex register_mutex;
};
/* I/O functions for GF1/InterWave chip - gus_io.c */
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index 3b44d4b370f..caf6fe21514 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -158,7 +158,7 @@ struct snd_sb_csp {
struct snd_kcontrol *qsound_switch;
struct snd_kcontrol *qsound_space;
- struct semaphore access_mutex; /* locking */
+ struct mutex access_mutex; /* locking */
};
int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index b78530d7ea9..d4b0e580557 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -387,9 +387,9 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
{
unsigned long flags;
- down(&chip->open_mutex);
+ mutex_lock(&chip->open_mutex);
if (chip->mode & AD1848_MODE_OPEN) {
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return -EAGAIN;
}
snd_ad1848_mce_down(chip);
@@ -432,7 +432,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
spin_unlock_irqrestore(&chip->reg_lock, flags);
chip->mode = mode;
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return 0;
}
@@ -441,9 +441,9 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
{
unsigned long flags;
- down(&chip->open_mutex);
+ mutex_lock(&chip->open_mutex);
if (!chip->mode) {
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return;
}
/* disable IRQ */
@@ -471,7 +471,7 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
spin_unlock_irqrestore(&chip->reg_lock, flags);
chip->mode = 0;
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
}
/*
@@ -889,7 +889,7 @@ int snd_ad1848_create(struct snd_card *card,
if (chip == NULL)
return -ENOMEM;
spin_lock_init(&chip->reg_lock);
- init_MUTEX(&chip->open_mutex);
+ mutex_init(&chip->open_mutex);
chip->card = card;
chip->port = port;
chip->irq = -1;
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index eab7eb59b5f..823db824670 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -531,7 +531,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
unsigned long flags;
int full_calib = 1;
- down(&chip->mce_mutex);
+ mutex_lock(&chip->mce_mutex);
snd_cs4231_calibrate_mute(chip, 1);
if (chip->hardware == CS4231_HW_CS4231A ||
(chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -560,7 +560,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
snd_cs4231_mce_down(chip);
}
snd_cs4231_calibrate_mute(chip, 0);
- up(&chip->mce_mutex);
+ mutex_unlock(&chip->mce_mutex);
}
static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
@@ -570,7 +570,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
unsigned long flags;
int full_calib = 1;
- down(&chip->mce_mutex);
+ mutex_lock(&chip->mce_mutex);
snd_cs4231_calibrate_mute(chip, 1);
if (chip->hardware == CS4231_HW_CS4231A ||
(chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -603,7 +603,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
snd_cs4231_mce_down(chip);
}
snd_cs4231_calibrate_mute(chip, 0);
- up(&chip->mce_mutex);
+ mutex_unlock(&chip->mce_mutex);
}
/*
@@ -709,15 +709,15 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
{
unsigned long flags;
- down(&chip->open_mutex);
+ mutex_lock(&chip->open_mutex);
if ((chip->mode & mode) ||
((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) {
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return -EAGAIN;
}
if (chip->mode & CS4231_MODE_OPEN) {
chip->mode |= mode;
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return 0;
}
/* ok. now enable and ack CODEC IRQ */
@@ -737,7 +737,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
spin_unlock_irqrestore(&chip->reg_lock, flags);
chip->mode = mode;
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return 0;
}
@@ -745,10 +745,10 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
{
unsigned long flags;
- down(&chip->open_mutex);
+ mutex_lock(&chip->open_mutex);
chip->mode &= ~mode;
if (chip->mode & CS4231_MODE_OPEN) {
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return;
}
snd_cs4231_calibrate_mute(chip, 1);
@@ -785,7 +785,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
snd_cs4231_calibrate_mute(chip, 0);
chip->mode = 0;
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
}
/*
@@ -1408,8 +1408,8 @@ static int snd_cs4231_new(struct snd_card *card,
chip->hwshare = hwshare;
spin_lock_init(&chip->reg_lock);
- init_MUTEX(&chip->mce_mutex);
- init_MUTEX(&chip->open_mutex);
+ mutex_init(&chip->mce_mutex);
+ mutex_init(&chip->open_mutex);
chip->card = card;
chip->rate_constraint = snd_cs4231_xrate;
chip->set_playback_format = snd_cs4231_playback_format;
@@ -1538,8 +1538,8 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm)
return err;
spin_lock_init(&chip->reg_lock);
- init_MUTEX(&chip->mce_mutex);
- init_MUTEX(&chip->open_mutex);
+ mutex_init(&chip->mce_mutex);
+ mutex_init(&chip->open_mutex);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops);
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c
index e36981d64ec..1125ddb2b1a 100644
--- a/sound/isa/cs423x/cs4236_lib.c
+++ b/sound/isa/cs423x/cs4236_lib.c
@@ -841,7 +841,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
enable = ucontrol->value.integer.value[0] & 1;
- down(&chip->mce_mutex);
+ mutex_lock(&chip->mce_mutex);
snd_cs4231_mce_up(chip);
spin_lock_irqsave(&chip->reg_lock, flags);
val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1);
@@ -854,7 +854,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
snd_cs4236_ctrl_out(chip, 4, val);
spin_unlock_irqrestore(&chip->reg_lock, flags);
snd_cs4231_mce_down(chip);
- up(&chip->mce_mutex);
+ mutex_unlock(&chip->mce_mutex);
#if 0
printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c
index 930f4bc56f3..44ee5d3674a 100644
--- a/sound/isa/gus/gus_dma.c
+++ b/sound/isa/gus/gus_dma.c
@@ -149,10 +149,10 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus)
int snd_gf1_dma_init(struct snd_gus_card * gus)
{
- down(&gus->dma_mutex);
+ mutex_lock(&gus->dma_mutex);
gus->gf1.dma_shared++;
if (gus->gf1.dma_shared > 1) {
- up(&gus->dma_mutex);
+ mutex_unlock(&gus->dma_mutex);
return 0;
}
gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt;
@@ -160,7 +160,7 @@ int snd_gf1_dma_init(struct snd_gus_card * gus)
gus->gf1.dma_data_pcm_last =
gus->gf1.dma_data_synth =
gus->gf1.dma_data_synth_last = NULL;
- up(&gus->dma_mutex);
+ mutex_unlock(&gus->dma_mutex);
return 0;
}
@@ -168,7 +168,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus)
{
struct snd_gf1_dma_block *block;
- down(&gus->dma_mutex);
+ mutex_lock(&gus->dma_mutex);
gus->gf1.dma_shared--;
if (!gus->gf1.dma_shared) {
snd_dma_disable(gus->gf1.dma1);
@@ -185,7 +185,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus)
gus->gf1.dma_data_pcm_last =
gus->gf1.dma_data_synth_last = NULL;
}
- up(&gus->dma_mutex);
+ mutex_unlock(&gus->dma_mutex);
return 0;
}
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 6d15b3d18a8..53eeaf37007 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -225,7 +225,7 @@ int snd_gus_create(struct snd_card *card,
spin_lock_init(&gus->dma_lock);
spin_lock_init(&gus->pcm_volume_level_lock);
spin_lock_init(&gus->uart_cmd_lock);
- init_MUTEX(&gus->dma_mutex);
+ mutex_init(&gus->dma_mutex);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) {
snd_gus_free(gus);
return err;
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index e8bdb860a19..3c0d27aa08b 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -34,9 +34,9 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup)
{
if (!xup) {
- down(&alloc->memory_mutex);
+ mutex_lock(&alloc->memory_mutex);
} else {
- up(&alloc->memory_mutex);
+ mutex_unlock(&alloc->memory_mutex);
}
}
@@ -59,7 +59,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
alloc->first = nblock;
else
nblock->prev->next = nblock;
- up(&alloc->memory_mutex);
+ mutex_unlock(&alloc->memory_mutex);
return NULL;
}
pblock = pblock->next;
@@ -80,7 +80,7 @@ int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * blo
{
if (block->share) { /* ok.. shared block */
block->share--;
- up(&alloc->memory_mutex);
+ mutex_unlock(&alloc->memory_mutex);
return 0;
}
if (alloc->first == block) {
@@ -244,7 +244,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus)
#endif
alloc = &gus->gf1.mem_alloc;
- init_MUTEX(&alloc->memory_mutex);
+ mutex_init(&alloc->memory_mutex);
alloc->first = alloc->last = NULL;
if (!gus->gf1.memory)
return 0;
@@ -299,7 +299,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
gus = entry->private_data;
alloc = &gus->gf1.mem_alloc;
- down(&alloc->memory_mutex);
+ mutex_lock(&alloc->memory_mutex);
snd_iprintf(buffer, "8-bit banks : \n ");
for (i = 0; i < 4; i++)
snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : "");
@@ -343,7 +343,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
}
snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n",
total, used, total - used);
- up(&alloc->memory_mutex);
+ mutex_unlock(&alloc->memory_mutex);
#if 0
ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n",
ultra_memory_free_size(card, &card->gf1.mem_alloc),
diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c
index 85a1b051f09..2767cc187ae 100644
--- a/sound/isa/gus/gus_synth.c
+++ b/sound/isa/gus/gus_synth.c
@@ -55,9 +55,9 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *
if (info->voices > 32)
return -EINVAL;
- down(&gus->register_mutex);
+ mutex_lock(&gus->register_mutex);
if (!snd_gus_use_inc(gus)) {
- up(&gus->register_mutex);
+ mutex_unlock(&gus->register_mutex);
return -EFAULT;
}
for (idx = 0; idx < info->voices; idx++) {
@@ -65,12 +65,12 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *
if (voice == NULL) {
snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
snd_gus_use_dec(gus);
- up(&gus->register_mutex);
+ mutex_unlock(&gus->register_mutex);
return -EBUSY;
}
voice->index = idx;
}
- up(&gus->register_mutex);
+ mutex_unlock(&gus->register_mutex);
return 0;
}
@@ -79,10 +79,10 @@ static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe
struct snd_gus_port * port = private_data;
struct snd_gus_card * gus = port->gus;
- down(&gus->register_mutex);
+ mutex_lock(&gus->register_mutex);
snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
snd_gus_use_dec(gus);
- up(&gus->register_mutex);
+ mutex_unlock(&gus->register_mutex);
return 0;
}
@@ -223,7 +223,7 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev)
if (gus == NULL)
return -EINVAL;
- init_MUTEX(&gus->register_mutex);
+ mutex_init(&gus->register_mutex);
gus->gf1.seq_client = -1;
/* allocate new client */
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index 9c2b5efbacb..9703c68e4e0 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -138,7 +138,7 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
p->ops.csp_stop = snd_sb_csp_stop;
p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer;
- init_MUTEX(&p->access_mutex);
+ mutex_init(&p->access_mutex);
sprintf(hw->name, "CSP v%d.%d", (version >> 4), (version & 0x0f));
hw->iface = SNDRV_HWDEP_IFACE_SB16CSP;
hw->private_data = p;
@@ -265,13 +265,13 @@ static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file)
*/
static int snd_sb_csp_use(struct snd_sb_csp * p)
{
- down(&p->access_mutex);
+ mutex_lock(&p->access_mutex);
if (p->used) {
- up(&p->access_mutex);
+ mutex_unlock(&p->access_mutex);
return -EAGAIN;
}
p->used++;
- up(&p->access_mutex);
+ mutex_unlock(&p->access_mutex);
return 0;
@@ -282,9 +282,9 @@ static int snd_sb_csp_use(struct snd_sb_csp * p)
*/
static int snd_sb_csp_unuse(struct snd_sb_csp * p)
{
- down(&p->access_mutex);
+ mutex_lock(&p->access_mutex);
p->used--;
- up(&p->access_mutex);
+ mutex_unlock(&p->access_mutex);
return 0;
}