Browse Source

[ALSA] semaphore -> mutex (PCI 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>
imx_3.10.17_1.0.0_ga
Ingo Molnar 15 years ago
committed by Jaroslav Kysela
parent
commit
62932df8fb
43 changed files with 549 additions and 489 deletions
  1. +2
    -2
      include/sound/ac97_codec.h
  2. +1
    -1
      include/sound/ak4531_codec.h
  3. +1
    -1
      include/sound/cs46xx.h
  4. +2
    -2
      include/sound/emu10k1.h
  5. +23
    -22
      sound/pci/ac97/ac97_codec.c
  6. +6
    -4
      sound/pci/ac97/ac97_patch.c
  7. +4
    -2
      sound/pci/ac97/ac97_pcm.c
  8. +8
    -6
      sound/pci/ac97/ac97_proc.c
  9. +15
    -13
      sound/pci/ac97/ak4531_codec.c
  10. +11
    -10
      sound/pci/atiixp.c
  11. +7
    -6
      sound/pci/atiixp_modem.c
  12. +13
    -12
      sound/pci/cmipci.c
  13. +27
    -25
      sound/pci/cs46xx/cs46xx_lib.c
  14. +30
    -28
      sound/pci/cs46xx/dsp_spos.c
  15. +4
    -2
      sound/pci/cs46xx/dsp_spos_scb_lib.c
  16. +3
    -2
      sound/pci/emu10k1/emu10k1_main.c
  17. +12
    -10
      sound/pci/emu10k1/emufx.c
  18. +14
    -12
      sound/pci/emu10k1/memory.c
  19. +17
    -15
      sound/pci/ens1370.c
  20. +12
    -10
      sound/pci/es1968.c
  21. +26
    -25
      sound/pci/hda/hda_codec.c
  22. +2
    -2
      sound/pci/hda/hda_codec.h
  23. +9
    -8
      sound/pci/hda/hda_intel.c
  24. +15
    -13
      sound/pci/hda/patch_analog.c
  25. +20
    -18
      sound/pci/ice1712/aureon.c
  26. +14
    -12
      sound/pci/ice1712/delta.c
  27. +14
    -12
      sound/pci/ice1712/hoontech.c
  28. +4
    -3
      sound/pci/ice1712/ice1712.c
  29. +5
    -5
      sound/pci/ice1712/ice1712.h
  30. +19
    -18
      sound/pci/ice1712/ice1724.c
  31. +6
    -4
      sound/pci/ice1712/phase.c
  32. +44
    -42
      sound/pci/ice1712/pontis.c
  33. +9
    -8
      sound/pci/korg1212/korg1212.c
  34. +11
    -10
      sound/pci/mixart/mixart.c
  35. +4
    -3
      sound/pci/mixart/mixart.h
  36. +10
    -8
      sound/pci/mixart/mixart_core.c
  37. +27
    -25
      sound/pci/mixart/mixart_mixer.c
  38. +9
    -7
      sound/pci/nm256/nm256.c
  39. +19
    -17
      sound/pci/pcxhr/pcxhr.c
  40. +3
    -2
      sound/pci/pcxhr/pcxhr.h
  41. +38
    -37
      sound/pci/pcxhr/pcxhr_mixer.c
  42. +19
    -17
      sound/pci/trident/trident_memory.c
  43. +10
    -8
      sound/pci/vx222/vx222_ops.c

+ 2
- 2
include/sound/ac97_codec.h View File

@ -456,8 +456,8 @@ struct snd_ac97 {
struct snd_info_entry *proc_regs;
unsigned short subsystem_vendor;
unsigned short subsystem_device;
struct semaphore reg_mutex;
struct semaphore page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */
struct mutex reg_mutex;
struct mutex page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */
unsigned short num; /* number of codec: 0 = primary, 1 = secondary */
unsigned short addr; /* physical address of codec [0-3] */
unsigned int id; /* identification of codec */


+ 1
- 1
include/sound/ak4531_codec.h View File

@ -71,7 +71,7 @@ struct snd_ak4531 {
void (*private_free) (struct snd_ak4531 *ak4531);
/* --- */
unsigned char regs[0x20];
struct semaphore reg_mutex;
struct mutex reg_mutex;
};
int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,


+ 1
- 1
include/sound/cs46xx.h View File

@ -1711,7 +1711,7 @@ struct snd_cs46xx {
int current_gpio;
#endif
#ifdef CONFIG_SND_CS46XX_NEW_DSP
struct semaphore spos_mutex;
struct mutex spos_mutex;
struct dsp_spos_instance * dsp_spos_instance;


+ 2
- 2
include/sound/emu10k1.h View File

@ -33,6 +33,7 @@
#include <sound/pcm-indirect.h>
#include <sound/timer.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <asm/io.h>
/* ------------------- DEFINES -------------------- */
@ -1022,7 +1023,7 @@ struct snd_emu10k1_fx8010 {
int gpr_size; /* size of allocated GPR controls */
int gpr_count; /* count of used kcontrols */
struct list_head gpr_ctl; /* GPR controls */
struct semaphore lock;
struct mutex lock;
struct snd_emu10k1_fx8010_pcm pcm[8];
spinlock_t irq_lock;
struct snd_emu10k1_fx8010_irq *irq_handlers;
@ -1122,7 +1123,6 @@ struct snd_emu10k1 {
spinlock_t reg_lock;
spinlock_t emu_lock;
spinlock_t voice_lock;
struct semaphore ptb_lock;
struct snd_emu10k1_voice voices[NUM_G];
struct snd_emu10k1_voice p16v_voices[4];


+ 23
- 22
sound/pci/ac97/ac97_codec.c View File

@ -28,6 +28,7 @@
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
@ -296,11 +297,11 @@ void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned sh
{
if (!snd_ac97_valid_reg(ac97, reg))
return;
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
ac97->regs[reg] = value;
ac97->bus->ops->write(ac97, reg, value);
set_bit(reg, ac97->reg_accessed);
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
}
/**
@ -321,14 +322,14 @@ int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short va
if (!snd_ac97_valid_reg(ac97, reg))
return -EINVAL;
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
change = ac97->regs[reg] != value;
if (change) {
ac97->regs[reg] = value;
ac97->bus->ops->write(ac97, reg, value);
}
set_bit(reg, ac97->reg_accessed);
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
return change;
}
@ -351,9 +352,9 @@ int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned sho
if (!snd_ac97_valid_reg(ac97, reg))
return -EINVAL;
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
change = snd_ac97_update_bits_nolock(ac97, reg, mask, value);
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
return change;
}
@ -380,12 +381,12 @@ static int snd_ac97_ad18xx_update_pcm_bits(struct snd_ac97 *ac97, int codec, uns
int change;
unsigned short old, new, cfg;
down(&ac97->page_mutex);
mutex_lock(&ac97->page_mutex);
old = ac97->spec.ad18xx.pcmreg[codec];
new = (old & ~mask) | value;
change = old != new;
if (change) {
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
cfg = snd_ac97_read_cache(ac97, AC97_AD_SERIAL_CFG);
ac97->spec.ad18xx.pcmreg[codec] = new;
/* select single codec */
@ -397,9 +398,9 @@ static int snd_ac97_ad18xx_update_pcm_bits(struct snd_ac97 *ac97, int codec, uns
/* select all codecs */
ac97->bus->ops->write(ac97, AC97_AD_SERIAL_CFG,
cfg | 0x7000);
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
}
up(&ac97->page_mutex);
mutex_unlock(&ac97->page_mutex);
return change;
}
@ -467,7 +468,7 @@ static int snd_ac97_page_save(struct snd_ac97 *ac97, int reg, struct snd_kcontro
(ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23 &&
(reg >= 0x60 && reg < 0x70)) {
unsigned short page = (kcontrol->private_value >> 26) & 0x0f;
down(&ac97->page_mutex); /* lock paging */
mutex_lock(&ac97->page_mutex); /* lock paging */
page_save = snd_ac97_read(ac97, AC97_INT_PAGING) & AC97_PAGE_MASK;
snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page);
}
@ -478,7 +479,7 @@ static void snd_ac97_page_restore(struct snd_ac97 *ac97, int page_save)
{
if (page_save >= 0) {
snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save);
up(&ac97->page_mutex); /* unlock paging */
mutex_unlock(&ac97->page_mutex); /* unlock paging */
}
}
@ -674,12 +675,12 @@ static int snd_ac97_spdif_default_get(struct snd_kcontrol *kcontrol, struct snd_
{
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
ucontrol->value.iec958.status[0] = ac97->spdif_status & 0xff;
ucontrol->value.iec958.status[1] = (ac97->spdif_status >> 8) & 0xff;
ucontrol->value.iec958.status[2] = (ac97->spdif_status >> 16) & 0xff;
ucontrol->value.iec958.status[3] = (ac97->spdif_status >> 24) & 0xff;
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
return 0;
}
@ -718,7 +719,7 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_
}
}
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
change = ac97->spdif_status != new;
ac97->spdif_status = new;
@ -746,7 +747,7 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_
snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); /* turn on again */
}
}
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
return change;
}
@ -763,7 +764,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
value = (ucontrol->value.integer.value[0] & mask);
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
mask <<= shift;
value <<= shift;
old = snd_ac97_read_cache(ac97, reg);
@ -777,7 +778,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
if (extst & AC97_EA_SPDIF)
snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); /* turn on again */
}
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
return change;
}
@ -888,10 +889,10 @@ static int snd_ac97_ad18xx_pcm_get_volume(struct snd_kcontrol *kcontrol, struct
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
int codec = kcontrol->private_value & 3;
down(&ac97->page_mutex);
mutex_lock(&ac97->page_mutex);
ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31);
ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31);
up(&ac97->page_mutex);
mutex_unlock(&ac97->page_mutex);
return 0;
}
@ -1856,8 +1857,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
ac97->limited_regs = template->limited_regs;
memcpy(ac97->reg_accessed, template->reg_accessed, sizeof(ac97->reg_accessed));
bus->codec[ac97->num] = ac97;
init_MUTEX(&ac97->reg_mutex);
init_MUTEX(&ac97->page_mutex);
mutex_init(&ac97->reg_mutex);
mutex_init(&ac97->page_mutex);
#ifdef CONFIG_PCI
if (ac97->pci) {


+ 6
- 4
sound/pci/ac97/ac97_patch.c View File

@ -27,6 +27,8 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/control.h>
@ -55,12 +57,12 @@ static int ac97_update_bits_page(struct snd_ac97 *ac97, unsigned short reg, unsi
unsigned short page_save;
int ret;
down(&ac97->page_mutex);
mutex_lock(&ac97->page_mutex);
page_save = snd_ac97_read(ac97, AC97_INT_PAGING) & AC97_PAGE_MASK;
snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page);
ret = snd_ac97_update_bits(ac97, reg, mask, value);
snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save);
up(&ac97->page_mutex); /* unlock paging */
mutex_unlock(&ac97->page_mutex); /* unlock paging */
return ret;
}
@ -897,12 +899,12 @@ static int snd_ac97_stac9708_put_bias(struct snd_kcontrol *kcontrol, struct snd_
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
int err;
down(&ac97->page_mutex);
mutex_lock(&ac97->page_mutex);
snd_ac97_write(ac97, AC97_SIGMATEL_BIAS1, 0xabba);
err = snd_ac97_update_bits(ac97, AC97_SIGMATEL_BIAS2, 0x0010,
(ucontrol->value.integer.value[0] & 1) << 4);
snd_ac97_write(ac97, AC97_SIGMATEL_BIAS1, 0);
up(&ac97->page_mutex);
mutex_unlock(&ac97->page_mutex);
return err;
}


+ 4
- 2
sound/pci/ac97/ac97_pcm.c View File

@ -27,6 +27,8 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/control.h>
@ -206,7 +208,7 @@ static int set_spdif_rate(struct snd_ac97 *ac97, unsigned short rate)
mask = AC97_SC_SPSR_MASK;
}
down(&ac97->reg_mutex);
mutex_lock(&ac97->reg_mutex);
old = snd_ac97_read(ac97, reg) & mask;
if (old != bits) {
snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0);
@ -231,7 +233,7 @@ static int set_spdif_rate(struct snd_ac97 *ac97, unsigned short rate)
ac97->spdif_status = sbits;
}
snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF);
up(&ac97->reg_mutex);
mutex_unlock(&ac97->reg_mutex);
return 0;
}


+ 8
- 6
sound/pci/ac97/ac97_proc.c View File

@ -24,6 +24,8 @@
#include <sound/driver.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/ac97_codec.h>
#include <sound/asoundef.h>
@ -338,7 +340,7 @@ static void snd_ac97_proc_read(struct snd_info_entry *entry, struct snd_info_buf
{
struct snd_ac97 *ac97 = entry->private_data;
down(&ac97->page_mutex);
mutex_lock(&ac97->page_mutex);
if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86
int idx;
for (idx = 0; idx < 3; idx++)
@ -364,7 +366,7 @@ static void snd_ac97_proc_read(struct snd_info_entry *entry, struct snd_info_buf
} else {
snd_ac97_proc_read_main(ac97, buffer, 0);
}
up(&ac97->page_mutex);
mutex_unlock(&ac97->page_mutex);
}
#ifdef CONFIG_SND_DEBUG
@ -374,7 +376,7 @@ static void snd_ac97_proc_regs_write(struct snd_info_entry *entry, struct snd_in
struct snd_ac97 *ac97 = entry->private_data;
char line[64];
unsigned int reg, val;
down(&ac97->page_mutex);
mutex_lock(&ac97->page_mutex);
while (!snd_info_get_line(buffer, line, sizeof(line))) {
if (sscanf(line, "%x %x", &reg, &val) != 2)
continue;
@ -382,7 +384,7 @@ static void snd_ac97_proc_regs_write(struct snd_info_entry *entry, struct snd_in
if (reg < 0x80 && (reg & 1) == 0 && val <= 0xffff)
snd_ac97_write_cache(ac97, reg, val);
}
up(&ac97->page_mutex);
mutex_unlock(&ac97->page_mutex);
}
#endif
@ -401,7 +403,7 @@ static void snd_ac97_proc_regs_read(struct snd_info_entry *entry,
{
struct snd_ac97 *ac97 = entry->private_data;
down(&ac97->page_mutex);
mutex_lock(&ac97->page_mutex);
if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86
int idx;
@ -417,7 +419,7 @@ static void snd_ac97_proc_regs_read(struct snd_info_entry *entry,
} else {
snd_ac97_proc_regs_read_main(ac97, buffer, 0);
}
up(&ac97->page_mutex);
mutex_unlock(&ac97->page_mutex);
}
void snd_ac97_proc_init(struct snd_ac97 * ac97)


+ 15
- 13
sound/pci/ac97/ak4531_codec.c View File

@ -23,6 +23,8 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/ak4531_codec.h>
@ -82,9 +84,9 @@ static int snd_ak4531_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
int invert = (kcontrol->private_value >> 22) & 1;
int val;
down(&ak4531->reg_mutex);
mutex_lock(&ak4531->reg_mutex);
val = (ak4531->regs[reg] >> shift) & mask;
up(&ak4531->reg_mutex);
mutex_unlock(&ak4531->reg_mutex);
if (invert) {
val = mask - val;
}
@ -107,11 +109,11 @@ static int snd_ak4531_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
val = mask - val;
}
val <<= shift;
down(&ak4531->reg_mutex);
mutex_lock(&ak4531->reg_mutex);
val = (ak4531->regs[reg] & ~(mask << shift)) | val;
change = val != ak4531->regs[reg];
ak4531->write(ak4531, reg, ak4531->regs[reg] = val);
up(&ak4531->reg_mutex);
mutex_unlock(&ak4531->reg_mutex);
return change;
}
@ -143,10 +145,10 @@ static int snd_ak4531_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
int invert = (kcontrol->private_value >> 22) & 1;
int left, right;
down(&ak4531->reg_mutex);
mutex_lock(&ak4531->reg_mutex);
left = (ak4531->regs[left_reg] >> left_shift) & mask;
right = (ak4531->regs[right_reg] >> right_shift) & mask;
up(&ak4531->reg_mutex);
mutex_unlock(&ak4531->reg_mutex);
if (invert) {
left = mask - left;
right = mask - right;
@ -176,7 +178,7 @@ static int snd_ak4531_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
}
left <<= left_shift;
right <<= right_shift;
down(&ak4531->reg_mutex);
mutex_lock(&ak4531->reg_mutex);
if (left_reg == right_reg) {
left = (ak4531->regs[left_reg] & ~((mask << left_shift) | (mask << right_shift))) | left | right;
change = left != ak4531->regs[left_reg];
@ -188,7 +190,7 @@ static int snd_ak4531_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
ak4531->write(ak4531, left_reg, ak4531->regs[left_reg] = left);
ak4531->write(ak4531, right_reg, ak4531->regs[right_reg] = right);
}
up(&ak4531->reg_mutex);
mutex_unlock(&ak4531->reg_mutex);
return change;
}
@ -215,12 +217,12 @@ static int snd_ak4531_get_input_sw(struct snd_kcontrol *kcontrol, struct snd_ctl
int left_shift = (kcontrol->private_value >> 16) & 0x0f;
int right_shift = (kcontrol->private_value >> 24) & 0x0f;
down(&ak4531->reg_mutex);
mutex_lock(&ak4531->reg_mutex);
ucontrol->value.integer.value[0] = (ak4531->regs[reg1] >> left_shift) & 1;
ucontrol->value.integer.value[1] = (ak4531->regs[reg2] >> left_shift) & 1;
ucontrol->value.integer.value[2] = (ak4531->regs[reg1] >> right_shift) & 1;
ucontrol->value.integer.value[3] = (ak4531->regs[reg2] >> right_shift) & 1;
up(&ak4531->reg_mutex);
mutex_unlock(&ak4531->reg_mutex);
return 0;
}
@ -234,7 +236,7 @@ static int snd_ak4531_put_input_sw(struct snd_kcontrol *kcontrol, struct snd_ctl
int change;
int val1, val2;
down(&ak4531->reg_mutex);
mutex_lock(&ak4531->reg_mutex);
val1 = ak4531->regs[reg1] & ~((1 << left_shift) | (1 << right_shift));
val2 = ak4531->regs[reg2] & ~((1 << left_shift) | (1 << right_shift));
val1 |= (ucontrol->value.integer.value[0] & 1) << left_shift;
@ -244,7 +246,7 @@ static int snd_ak4531_put_input_sw(struct snd_kcontrol *kcontrol, struct snd_ctl
change = val1 != ak4531->regs[reg1] || val2 != ak4531->regs[reg2];
ak4531->write(ak4531, reg1, ak4531->regs[reg1] = val1);
ak4531->write(ak4531, reg2, ak4531->regs[reg2] = val2);
up(&ak4531->reg_mutex);
mutex_unlock(&ak4531->reg_mutex);
return change;
}
@ -366,7 +368,7 @@ int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
if (ak4531 == NULL)
return -ENOMEM;
*ak4531 = *_ak4531;
init_MUTEX(&ak4531->reg_mutex);
mutex_init(&ak4531->reg_mutex);
if ((err = snd_component_add(card, "AK4531")) < 0) {
snd_ak4531_free(ak4531);
return err;


+ 11
- 10
sound/pci/atiixp.c View File

@ -27,6 +27,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@ -277,7 +278,7 @@ struct atiixp {
unsigned int codec_not_ready_bits; /* for codec detection */
int spdif_over_aclink; /* passed from the module option */
struct semaphore open_mutex; /* playback open mutex */
struct mutex open_mutex; /* playback open mutex */
};
@ -1051,9 +1052,9 @@ static int snd_atiixp_playback_open(struct snd_pcm_substream *substream)
struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
mutex_lock(&chip->open_mutex);
err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0);
up(&chip->open_mutex);
mutex_unlock(&chip->open_mutex);
if (err < 0)
return err;
substream->runtime->hw.channels_max = chip->max_channels;
@ -1068,9 +1069,9 @@ static int snd_atiixp_playback_close(struct snd_pcm_substream *substream)
{
struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
mutex_lock(&chip->open_mutex);
err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
up(&chip->open_mutex);
mutex_unlock(&chip->open_mutex);
return err;
}
@ -1090,12 +1091,12 @@ static int snd_atiixp_spdif_open(struct snd_pcm_substream *substream)
{
struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
mutex_lock(&chip->open_mutex);
if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */
err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 2);
else
err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_SPDIF], -1);
up(&chip->open_mutex);
mutex_unlock(&chip->open_mutex);
return err;
}
@ -1103,12 +1104,12 @@ static int snd_atiixp_spdif_close(struct snd_pcm_substream *substream)
{
struct atiixp *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
mutex_lock(&chip->open_mutex);
if (chip->spdif_over_aclink)
err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
else
err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_SPDIF]);
up(&chip->open_mutex);
mutex_unlock(&chip->open_mutex);
return err;
}
@ -1560,7 +1561,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
}
spin_lock_init(&chip->reg_lock);
init_MUTEX(&chip->open_mutex);
mutex_init(&chip->open_mutex);
chip->card = card;
chip->pci = pci;
chip->irq = -1;


+ 7
- 6
sound/pci/atiixp_modem.c View File

@ -27,6 +27,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@ -255,7 +256,7 @@ struct atiixp_modem {
unsigned int codec_not_ready_bits; /* for codec detection */
int spdif_over_aclink; /* passed from the module option */
struct semaphore open_mutex; /* playback open mutex */
struct mutex open_mutex; /* playback open mutex */
};
@ -911,9 +912,9 @@ static int snd_atiixp_playback_open(struct snd_pcm_substream *substream)
struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
mutex_lock(&chip->open_mutex);
err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0);
up(&chip->open_mutex);
mutex_unlock(&chip->open_mutex);
if (err < 0)
return err;
return 0;
@ -923,9 +924,9 @@ static int snd_atiixp_playback_close(struct snd_pcm_substream *substream)
{
struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
int err;
down(&chip->open_mutex);
mutex_lock(&chip->open_mutex);
err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
up(&chip->open_mutex);
mutex_unlock(&chip->open_mutex);
return err;
}
@ -1233,7 +1234,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
}
spin_lock_init(&chip->reg_lock);
init_MUTEX(&chip->open_mutex);
mutex_init(&chip->open_mutex);
chip->card = card;
chip->pci = pci;
chip->irq = -1;


+ 13
- 12
sound/pci/cmipci.c View File

@ -29,6 +29,7 @@
#include <linux/slab.h>
#include <linux/gameport.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
@ -439,7 +440,7 @@ struct cmipci {
struct snd_pcm_hardware *hw_info[3]; /* for playbacks */
int opened[2]; /* open mode */
struct semaphore open_mutex;
struct mutex open_mutex;
unsigned int mixer_insensitive: 1;
struct snd_kcontrol *mixer_res_ctl[CM_SAVED_MIXERS];
@ -641,14 +642,14 @@ static int snd_cmipci_playback2_hw_params(struct snd_pcm_substream *substream,
{
struct cmipci *cm = snd_pcm_substream_chip(substream);
if (params_channels(hw_params) > 2) {
down(&cm->open_mutex);
mutex_lock(&cm->open_mutex);
if (cm->opened[CM_CH_PLAY]) {
up(&cm->open_mutex);
mutex_unlock(&cm->open_mutex);
return -EBUSY;
}
/* reserve the channel A */
cm->opened[CM_CH_PLAY] = CM_OPEN_PLAYBACK_MULTI;
up(&cm->open_mutex);
mutex_unlock(&cm->open_mutex);
}
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
}
@ -1461,9 +1462,9 @@ static int open_device_check(struct cmipci *cm, int mode, struct snd_pcm_substre
* pcm framework doesn't pass file pointer before actually opened,
* we can't know whether blocking mode or not in open callback..
*/
down(&cm->open_mutex);
mutex_lock(&cm->open_mutex);
if (cm->opened[ch]) {
up(&cm->open_mutex);
mutex_unlock(&cm->open_mutex);
return -EBUSY;
}
cm->opened[ch] = mode;
@ -1475,7 +1476,7 @@ static int open_device_check(struct cmipci *cm, int mode, struct snd_pcm_substre
snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_ENDBDAC);
spin_unlock_irq(&cm->reg_lock);
}
up(&cm->open_mutex);
mutex_unlock(&cm->open_mutex);
return 0;
}
@ -1483,7 +1484,7 @@ static void close_device_check(struct cmipci *cm, int mode)
{
int ch = mode & CM_OPEN_CH_MASK;
down(&cm->open_mutex);
mutex_lock(&cm->open_mutex);
if (cm->opened[ch] == mode) {
if (cm->channel[ch].substream) {
snd_cmipci_ch_reset(cm, ch);
@ -1499,7 +1500,7 @@ static void close_device_check(struct cmipci *cm, int mode)
spin_unlock_irq(&cm->reg_lock);
}
}
up(&cm->open_mutex);
mutex_unlock(&cm->open_mutex);
}
/*
@ -1546,7 +1547,7 @@ static int snd_cmipci_playback2_open(struct snd_pcm_substream *substream)
if ((err = open_device_check(cm, CM_OPEN_PLAYBACK2, substream)) < 0) /* use channel B */
return err;
runtime->hw = snd_cmipci_playback2;
down(&cm->open_mutex);
mutex_lock(&cm->open_mutex);
if (! cm->opened[CM_CH_PLAY]) {
if (cm->can_multi_ch) {
runtime->hw.channels_max = cm->max_channels;
@ -1559,7 +1560,7 @@ static int snd_cmipci_playback2_open(struct snd_pcm_substream *substream)
}
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x10000);
}
up(&cm->open_mutex);
mutex_unlock(&cm->open_mutex);
return 0;
}
@ -2844,7 +2845,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
}
spin_lock_init(&cm->reg_lock);
init_MUTEX(&cm->open_mutex);
mutex_init(&cm->open_mutex);
cm->device = pci->device;
cm->card = card;
cm->pci = pci;


+ 27
- 25
sound/pci/cs46xx/cs46xx_lib.c View File

@ -53,6 +53,8 @@
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/gameport.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/control.h>
@ -909,22 +911,22 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
#ifdef CONFIG_SND_CS46XX_NEW_DSP
snd_assert (sample_rate != 0, return -ENXIO);
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
if (_cs46xx_adjust_sample_rate (chip,cpcm,sample_rate)) {
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return -ENXIO;
}
snd_assert (cpcm->pcm_channel != NULL);
if (!cpcm->pcm_channel) {
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return -ENXIO;
}
if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) {
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return -EINVAL;
}
@ -965,7 +967,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
}
if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) {
#ifdef CONFIG_SND_CS46XX_NEW_DSP
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
#endif
return err;
}
@ -989,7 +991,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
}
#ifdef CONFIG_SND_CS46XX_NEW_DSP
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
#endif
return 0;
@ -1319,7 +1321,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
cpcm->substream = substream;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
cpcm->pcm_channel = NULL;
cpcm->pcm_channel_id = pcm_channel_id;
@ -1328,7 +1330,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
&hw_constraints_period_sizes);
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
#else
chip->playback_pcm = cpcm; /* HACK */
#endif
@ -1367,9 +1369,9 @@ static int snd_cs46xx_playback_open_iec958(struct snd_pcm_substream *substream)
snd_printdd("open raw iec958 channel\n");
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
cs46xx_iec958_pre_open (chip);
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return _cs46xx_playback_open_channel(substream,DSP_IEC958_CHANNEL);
}
@ -1385,9 +1387,9 @@ static int snd_cs46xx_playback_close_iec958(struct snd_pcm_substream *substream)
err = snd_cs46xx_playback_close(substream);
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
cs46xx_iec958_post_close (chip);
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return err;
}
@ -1428,12 +1430,12 @@ static int snd_cs46xx_playback_close(struct snd_pcm_substream *substream)
if (!cpcm) return -ENXIO;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
if (cpcm->pcm_channel) {
cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel);
cpcm->pcm_channel = NULL;
}
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
#else
chip->playback_pcm = NULL;
#endif
@ -1848,7 +1850,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
switch (kcontrol->private_value) {
case CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT:
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED);
if (ucontrol->value.integer.value[0] && !change)
cs46xx_dsp_enable_spdif_out(chip);
@ -1856,7 +1858,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
cs46xx_dsp_disable_spdif_out(chip);
res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED));
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
break;
case CS46XX_MIXER_SPDIF_INPUT_ELEMENT:
change = chip->dsp_spos_instance->spdif_status_in;
@ -1997,12 +1999,12 @@ static int snd_cs46xx_spdif_default_get(struct snd_kcontrol *kcontrol,
struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff);
ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff);
ucontrol->value.iec958.status[2] = 0;
ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff);
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -2015,7 +2017,7 @@ static int snd_cs46xx_spdif_default_put(struct snd_kcontrol *kcontrol,
unsigned int val;
int change;
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) |
@ -2029,7 +2031,7 @@ static int snd_cs46xx_spdif_default_put(struct snd_kcontrol *kcontrol,
if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) )
cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return change;
}
@ -2050,12 +2052,12 @@ static int snd_cs46xx_spdif_stream_get(struct snd_kcontrol *kcontrol,
struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff);
ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff);
ucontrol->value.iec958.status[2] = 0;
ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff);
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -2068,7 +2070,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
unsigned int val;
int change;
down (&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) |
@ -2082,7 +2084,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN )
cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
up (&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return change;
}
@ -3755,7 +3757,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card,
}
spin_lock_init(&chip->reg_lock);
#ifdef CONFIG_SND_CS46XX_NEW_DSP
init_MUTEX(&chip->spos_mutex);
mutex_init(&chip->spos_mutex);
#endif
chip->card = card;
chip->pci = pci;


+ 30
- 28
sound/pci/cs46xx/dsp_spos.c View File

@ -28,6 +28,8 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
@ -287,7 +289,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
snd_assert(ins != NULL, return);
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
for (i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted) continue;
@ -298,7 +300,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
vfree(ins->symbol_table.symbols);
kfree(ins->modules);
kfree(ins);
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
}
int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module)
@ -497,7 +499,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
int i,j;
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer, "MODULES:\n");
for ( i = 0; i < ins->nmodules; ++i ) {
snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name);
@ -510,7 +512,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
desc->segment_type,desc->offset, desc->size);
}
}
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
}
static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
@ -521,7 +523,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
int i, j, col;
void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer, "TASK TREES:\n");
for ( i = 0; i < ins->ntask; ++i) {
snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name);
@ -538,7 +540,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
}
snd_iprintf(buffer,"\n");
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
}
static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
@ -548,7 +550,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
int i;
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer, "SCB's:\n");
for ( i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted)
@ -571,7 +573,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
}
snd_iprintf(buffer,"\n");
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
}
static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry,
@ -852,14 +854,14 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
}
ins->proc_scb_info_entry = entry;
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
/* register/update SCB's entries on proc */
for (i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted) continue;
cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i));
}
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -899,12 +901,12 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
ins->proc_task_info_entry = NULL;
}
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
for (i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted) continue;
cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) );
}
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
if (ins->proc_dsp_dir) {
snd_info_unregister (ins->proc_dsp_dir);
@ -1694,7 +1696,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL);
snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) {
/* time countdown enable */
@ -1738,7 +1740,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
/* monitor state */
ins->spdif_status_in = 1;
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -1750,7 +1752,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL);
snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
/* Remove the asynchronous receiver SCB */
cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb);
@ -1760,7 +1762,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
/* monitor state */
ins->spdif_status_in = 0;
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
/* restore amplifier */
chip->active_ctrl(chip, -1);
@ -1776,10 +1778,10 @@ int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
snd_assert (ins->pcm_input == NULL,return -EINVAL);
snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL);
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
"PCMSerialInput_Wave");
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -1790,10 +1792,10 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
snd_assert (ins->pcm_input != NULL,return -EINVAL);
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
cs46xx_dsp_remove_scb (chip,ins->pcm_input);
ins->pcm_input = NULL;
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -1805,10 +1807,10 @@ int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
snd_assert (ins->adc_input == NULL,return -EINVAL);
snd_assert (ins->codec_in_scb != NULL,return -EINVAL);
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
"PCMSerialInput_ADC");
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -1819,10 +1821,10 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
snd_assert (ins->adc_input != NULL,return -EINVAL);
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
cs46xx_dsp_remove_scb (chip,ins->adc_input);
ins->adc_input = NULL;
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -1869,7 +1871,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
struct dsp_scb_descriptor * scb;
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
/* main output */
scb = ins->master_mix_scb->sub_list_ptr;
@ -1888,7 +1890,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
ins->dac_volume_left = left;
ins->dac_volume_right = right;
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}
@ -1897,7 +1899,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
if (ins->asynch_rx_scb != NULL)
cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb,
@ -1906,7 +1908,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
ins->spdif_input_volume_left = left;
ins->spdif_input_volume_right = right;
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
return 0;
}

+ 4
- 2
sound/pci/cs46xx/dsp_spos_scb_lib.c View File

@ -28,6 +28,8 @@
#include <linux/pm.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
@ -77,7 +79,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
ins = chip->dsp_spos_instance;
down(&chip->spos_mutex);
mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer,"%04x %s:\n",scb->address,scb->scb_name);
for (col = 0,j = 0;j < 0x10; j++,col++) {
@ -105,7 +107,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
scb->task_entry->address);
snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count);
up(&chip->spos_mutex);
mutex_unlock(&chip->spos_mutex);
}
#endif


+ 3
- 2
sound/pci/emu10k1/emu10k1_main.c View File

@ -36,6 +36,8 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/emu10k1.h>
@ -1097,8 +1099,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
spin_lock_init(&emu->voice_lock);
spin_lock_init(&emu->synth_lock);
spin_lock_init(&emu->memblk_lock);
init_MUTEX(&emu->ptb_lock);
init_MUTEX(&emu->fx8010.lock);
mutex_init(&emu->fx8010.lock);
INIT_LIST_HEAD(&emu->mapped_link_head);
INIT_LIST_HEAD(&emu->mapped_order_link_head);
emu->pci = pci;


+ 12
- 10
sound/pci/emu10k1/emufx.c View File

@ -32,6 +32,8 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/emu10k1.h>
@ -874,7 +876,7 @@ static int snd_emu10k1_icode_poke(struct snd_emu10k1 *emu,
{
int err = 0;
down(&emu->fx8010.lock);
mutex_lock(&emu->fx8010.lock);
if ((err = snd_emu10k1_verify_controls(emu, icode)) < 0)
goto __error;
strlcpy(emu->fx8010.name, icode->name, sizeof(emu->fx8010.name));
@ -897,7 +899,7 @@ static int snd_emu10k1_icode_poke(struct snd_emu10k1 *emu,
else
snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg);
__error:
up(&emu->fx8010.lock);
mutex_unlock(&emu->fx8010.lock);
return err;
}
@ -906,7 +908,7 @@ static int snd_emu10k1_icode_peek(struct snd_emu10k1 *emu,
{
int err;
down(&emu->fx8010.lock);