Skip to content

Commit

Permalink
[ALSA] semaphore -> mutex (ISA part)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ingo Molnar authored and Jaroslav Kysela committed Mar 22, 2006
1 parent ef9f0a4 commit 8b7547f
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion include/sound/ad1848.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct snd_ad1848 {
#endif

spinlock_t reg_lock;
struct semaphore open_mutex;
struct mutex open_mutex;
};

/* exported functions */
Expand Down
4 changes: 2 additions & 2 deletions include/sound/cs4231.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions include/sound/gus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion include/sound/sb16_csp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions sound/isa/ad1848/ad1848_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand All @@ -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 */
Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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;
Expand Down
30 changes: 15 additions & 15 deletions sound/isa/cs423x/cs4231_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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,
Expand All @@ -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)) {
Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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 */
Expand All @@ -737,18 +737,18 @@ 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;
}

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);
Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions sound/isa/cs423x/cs4236_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions sound/isa/gus/gus_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,26 @@ 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;
gus->gf1.dma_data_pcm =
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;
}

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);
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion sound/isa/gus/gus_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions sound/isa/gus/gus_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ? "," : "");
Expand Down Expand Up @@ -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),
Expand Down
14 changes: 7 additions & 7 deletions sound/isa/gus/gus_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ 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++) {
voice = snd_gf1_alloc_voice(gus, SNDRV_GF1_VOICE_TYPE_SYNTH, info->sender.client, info->sender.port);
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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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 */
Expand Down
Loading

0 comments on commit 8b7547f

Please sign in to comment.