[ALSA] semaphore -> mutex (Archs, misc buses)

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>
This commit is contained in:
Ingo Molnar 2006-01-16 16:36:05 +01:00 committed by Jaroslav Kysela
parent 62932df8fb
commit 12aa757905
10 changed files with 55 additions and 54 deletions

View File

@ -73,7 +73,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned
if (ac97->num >= 4)
return;
down(&aaci->ac97_sem);
mutex_lock(&aaci->ac97_sem);
aaci_ac97_select_codec(aaci, ac97);
@ -91,7 +91,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned
v = readl(aaci->base + AACI_SLFR);
} while (v & (SLFR_1TXB|SLFR_2TXB));
up(&aaci->ac97_sem);
mutex_unlock(&aaci->ac97_sem);
}
/*
@ -105,7 +105,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
if (ac97->num >= 4)
return ~0;
down(&aaci->ac97_sem);
mutex_lock(&aaci->ac97_sem);
aaci_ac97_select_codec(aaci, ac97);
@ -145,7 +145,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
v = ~0;
}
up(&aaci->ac97_sem);
mutex_unlock(&aaci->ac97_sem);
return v;
}
@ -783,7 +783,7 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
card->shortname, dev->res.start, dev->irq[0]);
aaci = card->private_data;
init_MUTEX(&aaci->ac97_sem);
mutex_init(&aaci->ac97_sem);
spin_lock_init(&aaci->lock);
aaci->card = card;
aaci->dev = dev;

View File

@ -227,7 +227,7 @@ struct aaci {
unsigned int fifosize;
/* AC'97 */
struct semaphore ac97_sem;
struct mutex ac97_sem;
ac97_bus_t *ac97_bus;
u32 maincr;

View File

@ -25,7 +25,7 @@
#include <sound/initval.h>
#include <asm/irq.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
#include <asm/hardware.h>
#include <asm/arch/pxa-regs.h>
#include <asm/arch/audio.h>
@ -33,7 +33,7 @@
#include "pxa2xx-pcm.h"
static DECLARE_MUTEX(car_mutex);
static DEFINE_MUTEX(car_mutex);
static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
static volatile long gsr_bits;
@ -52,7 +52,7 @@ static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg
unsigned short val = -1;
volatile u32 *reg_addr;
down(&car_mutex);
mutex_lock(&car_mutex);
/* set up primary or secondary codec space */
reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
@ -79,7 +79,7 @@ static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg
/* but we've just started another cycle... */
wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
out: up(&car_mutex);
out: mutex_unlock(&car_mutex);
return val;
}
@ -87,7 +87,7 @@ static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigne
{
volatile u32 *reg_addr;
down(&car_mutex);
mutex_lock(&car_mutex);
/* set up primary or secondary codec space */
reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
@ -101,7 +101,7 @@ static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigne
printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n",
__FUNCTION__, reg, GSR | gsr_bits);
up(&car_mutex);
mutex_unlock(&car_mutex);
}
static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)

View File

@ -52,14 +52,14 @@ static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
{
struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
down(&_chip->mixer_mutex);
mutex_lock(&_chip->mixer_mutex);
if (chip->mic_level != ucontrol->value.integer.value[0]) {
vx_set_mic_level(_chip, ucontrol->value.integer.value[0]);
chip->mic_level = ucontrol->value.integer.value[0];
up(&_chip->mixer_mutex);
mutex_unlock(&_chip->mixer_mutex);
return 1;
}
up(&_chip->mixer_mutex);
mutex_unlock(&_chip->mixer_mutex);
return 0;
}
@ -95,14 +95,14 @@ static int vx_mic_boost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
{
struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
down(&_chip->mixer_mutex);
mutex_lock(&_chip->mixer_mutex);
if (chip->mic_level != ucontrol->value.integer.value[0]) {
vx_set_mic_boost(_chip, ucontrol->value.integer.value[0]);
chip->mic_level = ucontrol->value.integer.value[0];
up(&_chip->mixer_mutex);
mutex_unlock(&_chip->mixer_mutex);
return 1;
}
up(&_chip->mixer_mutex);
mutex_unlock(&_chip->mixer_mutex);
return 0;
}

View File

@ -115,8 +115,8 @@ struct snd_cs4231 {
unsigned char image[32]; /* registers image */
int mce_bit;
int calibrate_mute;
struct semaphore mce_mutex;
struct semaphore open_mutex;
struct mutex mce_mutex;
struct mutex open_mutex;
union {
#ifdef SBUS_SUPPORT
@ -775,7 +775,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_h
{
unsigned long flags;
down(&chip->mce_mutex);
mutex_lock(&chip->mce_mutex);
snd_cs4231_calibrate_mute(chip, 1);
snd_cs4231_mce_up(chip);
@ -790,7 +790,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_h
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, struct snd_pcm_hw_params *params,
@ -798,7 +798,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw
{
unsigned long flags;
down(&chip->mce_mutex);
mutex_lock(&chip->mce_mutex);
snd_cs4231_calibrate_mute(chip, 1);
snd_cs4231_mce_up(chip);
@ -819,7 +819,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw
snd_cs4231_mce_down(chip);
snd_cs4231_calibrate_mute(chip, 0);
up(&chip->mce_mutex);
mutex_unlock(&chip->mce_mutex);
}
/*
@ -933,14 +933,14 @@ 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)) {
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 */
@ -960,7 +960,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
spin_unlock_irqrestore(&chip->lock, flags);
chip->mode = mode;
up(&chip->open_mutex);
mutex_unlock(&chip->open_mutex);
return 0;
}
@ -968,10 +968,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);
@ -1008,7 +1008,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);
}
/*
@ -1969,8 +1969,8 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
spin_lock_init(&chip->lock);
spin_lock_init(&chip->c_dma.sbus_info.lock);
spin_lock_init(&chip->p_dma.sbus_info.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->dev_u.sdev = sdev;
chip->regs_size = sdev->reg_addrs[0].reg_size;
@ -2157,8 +2157,8 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card,
spin_lock_init(&chip->lock);
spin_lock_init(&chip->c_dma.ebus_info.lock);
spin_lock_init(&chip->p_dma.ebus_info.lock);
init_MUTEX(&chip->mce_mutex);
init_MUTEX(&chip->open_mutex);
mutex_init(&chip->mce_mutex);
mutex_init(&chip->open_mutex);
chip->flags |= CS4231_FLAG_EBUS;
chip->card = card;
chip->dev_u.pdev = edev->bus->self;

View File

@ -47,6 +47,7 @@
#include <linux/usb.h>
#include <linux/vmalloc.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/pcm.h>
@ -202,7 +203,7 @@ struct snd_usb_stream {
* the all interfaces on the same card as one sound device.
*/
static DECLARE_MUTEX(register_mutex);
static DEFINE_MUTEX(register_mutex);
static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
@ -3285,7 +3286,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
/* check whether it's already registered */
chip = NULL;
down(&register_mutex);
mutex_lock(&register_mutex);
for (i = 0; i < SNDRV_CARDS; i++) {
if (usb_chip[i] && usb_chip[i]->dev == dev) {
if (usb_chip[i]->shutdown) {
@ -3338,13 +3339,13 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
usb_chip[chip->index] = chip;
chip->num_interfaces++;
up(&register_mutex);
mutex_unlock(&register_mutex);
return chip;
__error:
if (chip && !chip->num_interfaces)
snd_card_free(chip->card);
up(&register_mutex);
mutex_unlock(&register_mutex);
__err_val:
return NULL;
}
@ -3364,7 +3365,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
chip = ptr;
card = chip->card;
down(&register_mutex);
mutex_lock(&register_mutex);
chip->shutdown = 1;
chip->num_interfaces--;
if (chip->num_interfaces <= 0) {
@ -3382,10 +3383,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
snd_usb_mixer_disconnect(p);
}
usb_chip[chip->index] = NULL;
up(&register_mutex);
mutex_unlock(&register_mutex);
snd_card_free(card);
} else {
up(&register_mutex);
mutex_unlock(&register_mutex);
}
}

View File

@ -351,7 +351,7 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device)
usX2Y(card)->chip.dev = device;
usX2Y(card)->chip.card = card;
init_waitqueue_head(&usX2Y(card)->prepare_wait_queue);
init_MUTEX (&usX2Y(card)->prepare_mutex);
mutex_init(&usX2Y(card)->prepare_mutex);
INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list);
strcpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");

View File

@ -34,7 +34,7 @@ struct usX2Ydev {
unsigned int rate,
format;
int chip_status;
struct semaphore prepare_mutex;
struct mutex prepare_mutex;
struct us428ctls_sharedmem *us428ctls_sharedmem;
int wait_iso_frame;
wait_queue_head_t us428ctls_wait_queue_head;

View File

@ -811,7 +811,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_usX2Y_substream *subs = runtime->private_data;
down(&subs->usX2Y->prepare_mutex);
mutex_lock(&subs->usX2Y->prepare_mutex);
snd_printdd("snd_usX2Y_hw_free(%p)\n", substream);
if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
@ -832,7 +832,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream)
usX2Y_urbs_release(subs);
}
}
up(&subs->usX2Y->prepare_mutex);
mutex_unlock(&subs->usX2Y->prepare_mutex);
return snd_pcm_lib_free_pages(substream);
}
/*
@ -849,7 +849,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream)
int err = 0;
snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream);
down(&usX2Y->prepare_mutex);
mutex_lock(&usX2Y->prepare_mutex);
usX2Y_subs_prepare(subs);
// Start hardware streams
// SyncStream first....
@ -869,7 +869,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream)
err = usX2Y_urbs_start(subs);
up_prepare_mutex:
up(&usX2Y->prepare_mutex);
mutex_unlock(&usX2Y->prepare_mutex);
return err;
}

View File

@ -366,7 +366,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_usX2Y_substream *subs = runtime->private_data,
*cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2];
down(&subs->usX2Y->prepare_mutex);
mutex_lock(&subs->usX2Y->prepare_mutex);
snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream);
if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
@ -395,7 +395,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream)
usX2Y_usbpcm_urbs_release(cap_subs2);
}
}
up(&subs->usX2Y->prepare_mutex);
mutex_unlock(&subs->usX2Y->prepare_mutex);
return snd_pcm_lib_free_pages(substream);
}
@ -503,7 +503,7 @@ static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream)
memset(usX2Y->hwdep_pcm_shm, 0, sizeof(struct snd_usX2Y_hwdep_pcm_shm));
}
down(&usX2Y->prepare_mutex);
mutex_lock(&usX2Y->prepare_mutex);
usX2Y_subs_prepare(subs);
// Start hardware streams
// SyncStream first....
@ -544,7 +544,7 @@ static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream)
usX2Y->hwdep_pcm_shm->capture_iso_start = -1;
up_prepare_mutex:
up(&usX2Y->prepare_mutex);
mutex_unlock(&usX2Y->prepare_mutex);
return err;
}
@ -621,7 +621,7 @@ static int usX2Y_pcms_lock_check(struct snd_card *card)
if (dev->type != SNDRV_DEV_PCM)
continue;
pcm = dev->device_data;
down(&pcm->open_mutex);
mutex_lock(&pcm->open_mutex);
}
list_for_each(list, &card->devices) {
int s;
@ -650,7 +650,7 @@ static void usX2Y_pcms_unlock(struct snd_card *card)
if (dev->type != SNDRV_DEV_PCM)
continue;
pcm = dev->device_data;
up(&pcm->open_mutex);
mutex_unlock(&pcm->open_mutex);
}
}