From 12aa757905d09b1dc2c1c3d0de3fa8f4c9726f2b Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 16 Jan 2006 16:36:05 +0100 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.c | 15 ++++++++------- sound/usb/usx2y/usbusx2y.c | 2 +- sound/usb/usx2y/usbusx2y.h | 2 +- sound/usb/usx2y/usbusx2yaudio.c | 8 ++++---- sound/usb/usx2y/usx2yhwdeppcm.c | 12 ++++++------ 5 files changed, 20 insertions(+), 19 deletions(-) (limited to 'sound/usb') diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c9476c237c4..53009bb642f 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -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(®ister_mutex); + mutex_lock(®ister_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(®ister_mutex); + mutex_unlock(®ister_mutex); return chip; __error: if (chip && !chip->num_interfaces) snd_card_free(chip->card); - up(®ister_mutex); + mutex_unlock(®ister_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(®ister_mutex); + mutex_lock(®ister_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(®ister_mutex); + mutex_unlock(®ister_mutex); snd_card_free(card); } else { - up(®ister_mutex); + mutex_unlock(®ister_mutex); } } diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index e0abb56bbe4..cfec38d7839 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c @@ -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""); diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h index 435c1feda9d..456b5fdbc33 100644 --- a/sound/usb/usx2y/usbusx2y.h +++ b/sound/usb/usx2y/usbusx2y.h @@ -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; diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index a6bbc7a6348..f6bd0dee563 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -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; } diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 796a7dcef09..315855082fe 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c @@ -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); } } -- cgit v1.2.3