提交 12aa7579 编写于 作者: I Ingo Molnar 提交者: Jaroslav Kysela

[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: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 62932df8
...@@ -73,7 +73,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned ...@@ -73,7 +73,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned
if (ac97->num >= 4) if (ac97->num >= 4)
return; return;
down(&aaci->ac97_sem); mutex_lock(&aaci->ac97_sem);
aaci_ac97_select_codec(aaci, ac97); aaci_ac97_select_codec(aaci, ac97);
...@@ -91,7 +91,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned ...@@ -91,7 +91,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned
v = readl(aaci->base + AACI_SLFR); v = readl(aaci->base + AACI_SLFR);
} while (v & (SLFR_1TXB|SLFR_2TXB)); } 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) ...@@ -105,7 +105,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
if (ac97->num >= 4) if (ac97->num >= 4)
return ~0; return ~0;
down(&aaci->ac97_sem); mutex_lock(&aaci->ac97_sem);
aaci_ac97_select_codec(aaci, ac97); aaci_ac97_select_codec(aaci, ac97);
...@@ -145,7 +145,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) ...@@ -145,7 +145,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
v = ~0; v = ~0;
} }
up(&aaci->ac97_sem); mutex_unlock(&aaci->ac97_sem);
return v; return v;
} }
...@@ -783,7 +783,7 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev) ...@@ -783,7 +783,7 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
card->shortname, dev->res.start, dev->irq[0]); card->shortname, dev->res.start, dev->irq[0]);
aaci = card->private_data; aaci = card->private_data;
init_MUTEX(&aaci->ac97_sem); mutex_init(&aaci->ac97_sem);
spin_lock_init(&aaci->lock); spin_lock_init(&aaci->lock);
aaci->card = card; aaci->card = card;
aaci->dev = dev; aaci->dev = dev;
......
...@@ -227,7 +227,7 @@ struct aaci { ...@@ -227,7 +227,7 @@ struct aaci {
unsigned int fifosize; unsigned int fifosize;
/* AC'97 */ /* AC'97 */
struct semaphore ac97_sem; struct mutex ac97_sem;
ac97_bus_t *ac97_bus; ac97_bus_t *ac97_bus;
u32 maincr; u32 maincr;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <sound/initval.h> #include <sound/initval.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/semaphore.h> #include <linux/mutex.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/arch/pxa-regs.h> #include <asm/arch/pxa-regs.h>
#include <asm/arch/audio.h> #include <asm/arch/audio.h>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "pxa2xx-pcm.h" #include "pxa2xx-pcm.h"
static DECLARE_MUTEX(car_mutex); static DEFINE_MUTEX(car_mutex);
static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
static volatile long gsr_bits; static volatile long gsr_bits;
...@@ -52,7 +52,7 @@ static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg ...@@ -52,7 +52,7 @@ static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg
unsigned short val = -1; unsigned short val = -1;
volatile u32 *reg_addr; volatile u32 *reg_addr;
down(&car_mutex); mutex_lock(&car_mutex);
/* set up primary or secondary codec space */ /* set up primary or secondary codec space */
reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; 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 ...@@ -79,7 +79,7 @@ static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg
/* but we've just started another cycle... */ /* but we've just started another cycle... */
wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1); wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
out: up(&car_mutex); out: mutex_unlock(&car_mutex);
return val; return val;
} }
...@@ -87,7 +87,7 @@ static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigne ...@@ -87,7 +87,7 @@ static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigne
{ {
volatile u32 *reg_addr; volatile u32 *reg_addr;
down(&car_mutex); mutex_lock(&car_mutex);
/* set up primary or secondary codec space */ /* set up primary or secondary codec space */
reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; 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 ...@@ -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", printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n",
__FUNCTION__, reg, GSR | gsr_bits); __FUNCTION__, reg, GSR | gsr_bits);
up(&car_mutex); mutex_unlock(&car_mutex);
} }
static void pxa2xx_ac97_reset(struct snd_ac97 *ac97) static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
......
...@@ -52,14 +52,14 @@ static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v ...@@ -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 vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; 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]) { if (chip->mic_level != ucontrol->value.integer.value[0]) {
vx_set_mic_level(_chip, ucontrol->value.integer.value[0]); vx_set_mic_level(_chip, ucontrol->value.integer.value[0]);
chip->mic_level = ucontrol->value.integer.value[0]; chip->mic_level = ucontrol->value.integer.value[0];
up(&_chip->mixer_mutex); mutex_unlock(&_chip->mixer_mutex);
return 1; return 1;
} }
up(&_chip->mixer_mutex); mutex_unlock(&_chip->mixer_mutex);
return 0; return 0;
} }
...@@ -95,14 +95,14 @@ static int vx_mic_boost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v ...@@ -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 vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; 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]) { if (chip->mic_level != ucontrol->value.integer.value[0]) {
vx_set_mic_boost(_chip, ucontrol->value.integer.value[0]); vx_set_mic_boost(_chip, ucontrol->value.integer.value[0]);
chip->mic_level = ucontrol->value.integer.value[0]; chip->mic_level = ucontrol->value.integer.value[0];
up(&_chip->mixer_mutex); mutex_unlock(&_chip->mixer_mutex);
return 1; return 1;
} }
up(&_chip->mixer_mutex); mutex_unlock(&_chip->mixer_mutex);
return 0; return 0;
} }
......
...@@ -115,8 +115,8 @@ struct snd_cs4231 { ...@@ -115,8 +115,8 @@ struct snd_cs4231 {
unsigned char image[32]; /* registers image */ unsigned char image[32]; /* registers image */
int mce_bit; int mce_bit;
int calibrate_mute; int calibrate_mute;
struct semaphore mce_mutex; struct mutex mce_mutex;
struct semaphore open_mutex; struct mutex open_mutex;
union { union {
#ifdef SBUS_SUPPORT #ifdef SBUS_SUPPORT
...@@ -775,7 +775,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_h ...@@ -775,7 +775,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_h
{ {
unsigned long flags; unsigned long flags;
down(&chip->mce_mutex); mutex_lock(&chip->mce_mutex);
snd_cs4231_calibrate_mute(chip, 1); snd_cs4231_calibrate_mute(chip, 1);
snd_cs4231_mce_up(chip); snd_cs4231_mce_up(chip);
...@@ -790,7 +790,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_h ...@@ -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_mce_down(chip);
snd_cs4231_calibrate_mute(chip, 0); 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, 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 ...@@ -798,7 +798,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw
{ {
unsigned long flags; unsigned long flags;
down(&chip->mce_mutex); mutex_lock(&chip->mce_mutex);
snd_cs4231_calibrate_mute(chip, 1); snd_cs4231_calibrate_mute(chip, 1);
snd_cs4231_mce_up(chip); snd_cs4231_mce_up(chip);
...@@ -819,7 +819,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw ...@@ -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_mce_down(chip);
snd_cs4231_calibrate_mute(chip, 0); 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) ...@@ -933,14 +933,14 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
{ {
unsigned long flags; unsigned long flags;
down(&chip->open_mutex); mutex_lock(&chip->open_mutex);
if ((chip->mode & mode)) { if ((chip->mode & mode)) {
up(&chip->open_mutex); mutex_unlock(&chip->open_mutex);
return -EAGAIN; return -EAGAIN;
} }
if (chip->mode & CS4231_MODE_OPEN) { if (chip->mode & CS4231_MODE_OPEN) {
chip->mode |= mode; chip->mode |= mode;
up(&chip->open_mutex); mutex_unlock(&chip->open_mutex);
return 0; return 0;
} }
/* ok. now enable and ack CODEC IRQ */ /* ok. now enable and ack CODEC IRQ */
...@@ -960,7 +960,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) ...@@ -960,7 +960,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
spin_unlock_irqrestore(&chip->lock, flags); spin_unlock_irqrestore(&chip->lock, flags);
chip->mode = mode; chip->mode = mode;
up(&chip->open_mutex); mutex_unlock(&chip->open_mutex);
return 0; return 0;
} }
...@@ -968,10 +968,10 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) ...@@ -968,10 +968,10 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
{ {
unsigned long flags; unsigned long flags;
down(&chip->open_mutex); mutex_lock(&chip->open_mutex);
chip->mode &= ~mode; chip->mode &= ~mode;
if (chip->mode & CS4231_MODE_OPEN) { if (chip->mode & CS4231_MODE_OPEN) {
up(&chip->open_mutex); mutex_unlock(&chip->open_mutex);
return; return;
} }
snd_cs4231_calibrate_mute(chip, 1); snd_cs4231_calibrate_mute(chip, 1);
...@@ -1008,7 +1008,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) ...@@ -1008,7 +1008,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
snd_cs4231_calibrate_mute(chip, 0); snd_cs4231_calibrate_mute(chip, 0);
chip->mode = 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, ...@@ -1969,8 +1969,8 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
spin_lock_init(&chip->lock); spin_lock_init(&chip->lock);
spin_lock_init(&chip->c_dma.sbus_info.lock); spin_lock_init(&chip->c_dma.sbus_info.lock);
spin_lock_init(&chip->p_dma.sbus_info.lock); spin_lock_init(&chip->p_dma.sbus_info.lock);
init_MUTEX(&chip->mce_mutex); mutex_init(&chip->mce_mutex);
init_MUTEX(&chip->open_mutex); mutex_init(&chip->open_mutex);
chip->card = card; chip->card = card;
chip->dev_u.sdev = sdev; chip->dev_u.sdev = sdev;
chip->regs_size = sdev->reg_addrs[0].reg_size; chip->regs_size = sdev->reg_addrs[0].reg_size;
...@@ -2157,8 +2157,8 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card, ...@@ -2157,8 +2157,8 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card,
spin_lock_init(&chip->lock); spin_lock_init(&chip->lock);
spin_lock_init(&chip->c_dma.ebus_info.lock); spin_lock_init(&chip->c_dma.ebus_info.lock);
spin_lock_init(&chip->p_dma.ebus_info.lock); spin_lock_init(&chip->p_dma.ebus_info.lock);
init_MUTEX(&chip->mce_mutex); mutex_init(&chip->mce_mutex);
init_MUTEX(&chip->open_mutex); mutex_init(&chip->open_mutex);
chip->flags |= CS4231_FLAG_EBUS; chip->flags |= CS4231_FLAG_EBUS;
chip->card = card; chip->card = card;
chip->dev_u.pdev = edev->bus->self; chip->dev_u.pdev = edev->bus->self;
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/info.h> #include <sound/info.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -202,7 +203,7 @@ struct snd_usb_stream { ...@@ -202,7 +203,7 @@ struct snd_usb_stream {
* the all interfaces on the same card as one sound device. * 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]; static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
...@@ -3285,7 +3286,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev, ...@@ -3285,7 +3286,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
/* check whether it's already registered */ /* check whether it's already registered */
chip = NULL; chip = NULL;
down(&register_mutex); mutex_lock(&register_mutex);
for (i = 0; i < SNDRV_CARDS; i++) { for (i = 0; i < SNDRV_CARDS; i++) {
if (usb_chip[i] && usb_chip[i]->dev == dev) { if (usb_chip[i] && usb_chip[i]->dev == dev) {
if (usb_chip[i]->shutdown) { if (usb_chip[i]->shutdown) {
...@@ -3338,13 +3339,13 @@ static void *snd_usb_audio_probe(struct usb_device *dev, ...@@ -3338,13 +3339,13 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
usb_chip[chip->index] = chip; usb_chip[chip->index] = chip;
chip->num_interfaces++; chip->num_interfaces++;
up(&register_mutex); mutex_unlock(&register_mutex);
return chip; return chip;
__error: __error:
if (chip && !chip->num_interfaces) if (chip && !chip->num_interfaces)
snd_card_free(chip->card); snd_card_free(chip->card);
up(&register_mutex); mutex_unlock(&register_mutex);
__err_val: __err_val:
return NULL; return NULL;
} }
...@@ -3364,7 +3365,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) ...@@ -3364,7 +3365,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
chip = ptr; chip = ptr;
card = chip->card; card = chip->card;
down(&register_mutex); mutex_lock(&register_mutex);
chip->shutdown = 1; chip->shutdown = 1;
chip->num_interfaces--; chip->num_interfaces--;
if (chip->num_interfaces <= 0) { if (chip->num_interfaces <= 0) {
...@@ -3382,10 +3383,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) ...@@ -3382,10 +3383,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
snd_usb_mixer_disconnect(p); snd_usb_mixer_disconnect(p);
} }
usb_chip[chip->index] = NULL; usb_chip[chip->index] = NULL;
up(&register_mutex); mutex_unlock(&register_mutex);
snd_card_free(card); snd_card_free(card);
} else { } else {
up(&register_mutex); mutex_unlock(&register_mutex);
} }
} }
......
...@@ -351,7 +351,7 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device) ...@@ -351,7 +351,7 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device)
usX2Y(card)->chip.dev = device; usX2Y(card)->chip.dev = device;
usX2Y(card)->chip.card = card; usX2Y(card)->chip.card = card;
init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); 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); INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list);
strcpy(card->driver, "USB "NAME_ALLCAPS""); strcpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
......
...@@ -34,7 +34,7 @@ struct usX2Ydev { ...@@ -34,7 +34,7 @@ struct usX2Ydev {
unsigned int rate, unsigned int rate,
format; format;
int chip_status; int chip_status;
struct semaphore prepare_mutex; struct mutex prepare_mutex;
struct us428ctls_sharedmem *us428ctls_sharedmem; struct us428ctls_sharedmem *us428ctls_sharedmem;
int wait_iso_frame; int wait_iso_frame;
wait_queue_head_t us428ctls_wait_queue_head; wait_queue_head_t us428ctls_wait_queue_head;
......
...@@ -811,7 +811,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) ...@@ -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_pcm_runtime *runtime = substream->runtime;
struct snd_usX2Y_substream *subs = runtime->private_data; 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); snd_printdd("snd_usX2Y_hw_free(%p)\n", substream);
if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
...@@ -832,7 +832,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) ...@@ -832,7 +832,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream)
usX2Y_urbs_release(subs); usX2Y_urbs_release(subs);
} }
} }
up(&subs->usX2Y->prepare_mutex); mutex_unlock(&subs->usX2Y->prepare_mutex);
return snd_pcm_lib_free_pages(substream); return snd_pcm_lib_free_pages(substream);
} }
/* /*
...@@ -849,7 +849,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -849,7 +849,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream)
int err = 0; int err = 0;
snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream);
down(&usX2Y->prepare_mutex); mutex_lock(&usX2Y->prepare_mutex);
usX2Y_subs_prepare(subs); usX2Y_subs_prepare(subs);
// Start hardware streams // Start hardware streams
// SyncStream first.... // SyncStream first....
...@@ -869,7 +869,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -869,7 +869,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream)
err = usX2Y_urbs_start(subs); err = usX2Y_urbs_start(subs);
up_prepare_mutex: up_prepare_mutex:
up(&usX2Y->prepare_mutex); mutex_unlock(&usX2Y->prepare_mutex);
return err; return err;
} }
......
...@@ -366,7 +366,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) ...@@ -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_pcm_runtime *runtime = substream->runtime;
struct snd_usX2Y_substream *subs = runtime->private_data, struct snd_usX2Y_substream *subs = runtime->private_data,
*cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; *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); snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream);
if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
...@@ -395,7 +395,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) ...@@ -395,7 +395,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream)
usX2Y_usbpcm_urbs_release(cap_subs2); usX2Y_usbpcm_urbs_release(cap_subs2);
} }
} }
up(&subs->usX2Y->prepare_mutex); mutex_unlock(&subs->usX2Y->prepare_mutex);
return snd_pcm_lib_free_pages(substream); return snd_pcm_lib_free_pages(substream);
} }
...@@ -503,7 +503,7 @@ static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *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)); 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); usX2Y_subs_prepare(subs);
// Start hardware streams // Start hardware streams
// SyncStream first.... // SyncStream first....
...@@ -544,7 +544,7 @@ static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream) ...@@ -544,7 +544,7 @@ static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream)
usX2Y->hwdep_pcm_shm->capture_iso_start = -1; usX2Y->hwdep_pcm_shm->capture_iso_start = -1;
up_prepare_mutex: up_prepare_mutex:
up(&usX2Y->prepare_mutex); mutex_unlock(&usX2Y->prepare_mutex);
return err; return err;
} }
...@@ -621,7 +621,7 @@ static int usX2Y_pcms_lock_check(struct snd_card *card) ...@@ -621,7 +621,7 @@ static int usX2Y_pcms_lock_check(struct snd_card *card)
if (dev->type != SNDRV_DEV_PCM) if (dev->type != SNDRV_DEV_PCM)
continue; continue;
pcm = dev->device_data; pcm = dev->device_data;
down(&pcm->open_mutex); mutex_lock(&pcm->open_mutex);
} }
list_for_each(list, &card->devices) { list_for_each(list, &card->devices) {
int s; int s;
...@@ -650,7 +650,7 @@ static void usX2Y_pcms_unlock(struct snd_card *card) ...@@ -650,7 +650,7 @@ static void usX2Y_pcms_unlock(struct snd_card *card)
if (dev->type != SNDRV_DEV_PCM) if (dev->type != SNDRV_DEV_PCM)
continue; continue;
pcm = dev->device_data; pcm = dev->device_data;
up(&pcm->open_mutex); mutex_unlock(&pcm->open_mutex);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册