summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/ac97_codec.h4
-rw-r--r--include/sound/ak4531_codec.h2
-rw-r--r--include/sound/cs46xx.h2
-rw-r--r--include/sound/emu10k1.h4
-rw-r--r--sound/pci/ac97/ac97_codec.c45
-rw-r--r--sound/pci/ac97/ac97_patch.c10
-rw-r--r--sound/pci/ac97/ac97_pcm.c6
-rw-r--r--sound/pci/ac97/ac97_proc.c14
-rw-r--r--sound/pci/ac97/ak4531_codec.c28
-rw-r--r--sound/pci/atiixp.c21
-rw-r--r--sound/pci/atiixp_modem.c13
-rw-r--r--sound/pci/cmipci.c25
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c52
-rw-r--r--sound/pci/cs46xx/dsp_spos.c58
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c6
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c5
-rw-r--r--sound/pci/emu10k1/emufx.c22
-rw-r--r--sound/pci/emu10k1/memory.c26
-rw-r--r--sound/pci/ens1370.c32
-rw-r--r--sound/pci/es1968.c22
-rw-r--r--sound/pci/hda/hda_codec.c51
-rw-r--r--sound/pci/hda/hda_codec.h4
-rw-r--r--sound/pci/hda/hda_intel.c17
-rw-r--r--sound/pci/hda/patch_analog.c28
-rw-r--r--sound/pci/ice1712/aureon.c38
-rw-r--r--sound/pci/ice1712/delta.c26
-rw-r--r--sound/pci/ice1712/hoontech.c26
-rw-r--r--sound/pci/ice1712/ice1712.c7
-rw-r--r--sound/pci/ice1712/ice1712.h10
-rw-r--r--sound/pci/ice1712/ice1724.c37
-rw-r--r--sound/pci/ice1712/phase.c10
-rw-r--r--sound/pci/ice1712/pontis.c86
-rw-r--r--sound/pci/korg1212/korg1212.c17
-rw-r--r--sound/pci/mixart/mixart.c21
-rw-r--r--sound/pci/mixart/mixart.h7
-rw-r--r--sound/pci/mixart/mixart_core.c18
-rw-r--r--sound/pci/mixart/mixart_mixer.c52
-rw-r--r--sound/pci/nm256/nm256.c16
-rw-r--r--sound/pci/pcxhr/pcxhr.c36
-rw-r--r--sound/pci/pcxhr/pcxhr.h5
-rw-r--r--sound/pci/pcxhr/pcxhr_mixer.c75
-rw-r--r--sound/pci/trident/trident_memory.c36
-rw-r--r--sound/pci/vx222/vx222_ops.c18
43 files changed, 549 insertions, 489 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index b0b3ea7b365..ad3fe046f6c 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -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 */
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index edf04070ce7..fb30faab43a 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -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,
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 199b5098ff7..80b2979c0cb 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -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;
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 951e40d720d..186e00ad9e7 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -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];
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 3020ca2b602..6108cdc5efb 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -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) {
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index a444a78c7c9..8bc79cbe321 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -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;
}
diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c
index c3e590bf7a0..512a3583b0c 100644
--- a/sound/pci/ac97/ac97_pcm.c
+++ b/sound/pci/ac97/ac97_pcm.c
@@ -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;
}
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c
index 7134b3f55fb..4d523df79cc 100644
--- a/sound/pci/ac97/ac97_proc.c
+++ b/sound/pci/ac97/ac97_proc.c
@@ -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)
diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c
index dcfb5036ff8..0fb7b340731 100644
--- a/sound/pci/ac97/ak4531_codec.c
+++ b/sound/pci/ac97/ak4531_codec.c
@@ -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;
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index b7217adaf1d..12e61885126 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -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;
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 8d8fd5a4ed3..1d376604464 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -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;
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index c03b0a0a3b2..2ecbddbbdcf 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -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;
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 8fb275d6eb7..69dbf542a6d 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -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;
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 445a448949e..8726a68051e 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -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;
}
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
index d4e0fb39bd0..2c4ee45fe10 100644
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
+++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -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
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 3c7043b7d4c..103a3f7708b 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -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;
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 50983725273..dfba00230d4 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -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);
+ mutex_lock(&emu->fx8010.lock);
strlcpy(icode->name, emu->fx8010.name, sizeof(icode->name));
/* ok, do the main job */
err = snd_emu10k1_gpr_peek(emu, icode);
@@ -916,7 +918,7 @@ static int snd_emu10k1_icode_peek(struct snd_emu10k1 *emu,
err = snd_emu10k1_code_peek(emu, icode);
if (err >= 0)
err = snd_emu10k1_list_controls(emu, icode);
- up(&emu->fx8010.lock);
+ mutex_unlock(&emu->fx8010.lock);
return err;
}
@@ -932,7 +934,7 @@ static int snd_emu10k1_ipcm_poke(struct snd_emu10k1 *emu,
if (ipcm->channels > 32)
return -EINVAL;
pcm = &emu->fx8010.pcm[ipcm->substream];
- down(&emu->fx8010.lock);
+ mutex_lock(&emu->fx8010.lock);
spin_lock_irq(&emu->reg_lock);
if (pcm->opened) {
err = -EBUSY;
@@ -962,7 +964,7 @@ static int snd_emu10k1_ipcm_poke(struct snd_emu10k1 *emu,
}
__error:
spin_unlock_irq(&emu->reg_lock);
- up(&emu->fx8010.lock);
+ mutex_unlock(&emu->fx8010.lock);
return err;
}
@@ -976,7 +978,7 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu,
if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT)
return -EINVAL;
pcm = &emu->fx8010.pcm[ipcm->substream];
- down(&emu->fx8010.lock);
+ mutex_lock(&emu->fx8010.lock);
spin_lock_irq(&emu->reg_lock);
ipcm->channels = pcm->channels;
ipcm->tram_start = pcm->tram_start;
@@ -992,7 +994,7 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu,
ipcm->res1 = ipcm->res2 = 0;
ipcm->pad = 0;
spin_unlock_irq(&emu->reg_lock);
- up(&emu->fx8010.lock);
+ mutex_unlock(&emu->fx8010.lock);
return err;
}
@@ -2308,9 +2310,9 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un
return -EPERM;
if (get_user(addr, (unsigned int __user *)argp))
return -EFAULT;
- down(&emu->fx8010.lock);
+ mutex_lock(&emu->fx8010.lock);
res = snd_emu10k1_fx8010_tram_setup(emu, addr);
- up(&emu->fx8010.lock);
+ mutex_unlock(&emu->fx8010.lock);
return res;
case SNDRV_EMU10K1_IOCTL_STOP:
if (!capable(CAP_SYS_ADMIN))
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
index 68c795c0310..e7ec98649f0 100644
--- a/sound/pci/emu10k1/memory.c
+++ b/sound/pci/emu10k1/memory.c
@@ -24,6 +24,8 @@
#include <sound/driver.h>
#include <linux/pci.h>
#include <linux/time.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/emu10k1.h>
@@ -302,10 +304,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
hdr = emu->memhdr;
snd_assert(hdr, return NULL);
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
blk = search_empty(emu, runtime->dma_bytes);
if (blk == NULL) {
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
/* fill buffer addresses but pointers are not stored so that
@@ -318,14 +320,14 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
if (idx >= sgbuf->pages) {
printk(KERN_ERR "emu: pages overflow! (%d-%d) for %d\n",
blk->first_page, blk->last_page, sgbuf->pages);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
#endif
addr = sgbuf->table[idx].addr;
if (! is_valid_page(emu, addr)) {
printk(KERN_ERR "emu: failure page = %d\n", idx);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
emu->page_addr_table[page] = addr;
@@ -337,10 +339,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
err = snd_emu10k1_memblk_map(emu, blk);
if (err < 0) {
__snd_util_mem_free(hdr, (struct snd_util_memblk *)blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return (struct snd_util_memblk *)blk;
}
@@ -369,19 +371,19 @@ snd_emu10k1_synth_alloc(struct snd_emu10k1 *hw, unsigned int size)
struct snd_emu10k1_memblk *blk;
struct snd_util_memhdr *hdr = hw->memhdr;
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size);
if (blk == NULL) {
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
if (synth_alloc_pages(hw, blk)) {
__snd_util_mem_free(hdr, (struct snd_util_memblk *)blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
snd_emu10k1_memblk_map(hw, blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return (struct snd_util_memblk *)blk;
}
@@ -396,14 +398,14 @@ snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *memblk)
struct snd_emu10k1_memblk *blk = (struct snd_emu10k1_memblk *)memblk;
unsigned long flags;
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
spin_lock_irqsave(&emu->memblk_lock, flags);
if (blk->mapped_page >= 0)
unmap_memblk(emu, blk);
spin_unlock_irqrestore(&emu->memblk_lock, flags);
synth_free_pages(emu, blk);
__snd_util_mem_free(hdr, memblk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return 0;
}
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index bee382995fe..a5533c86b0b 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -35,6 +35,8 @@
#include <linux/slab.h>
#include <linux/gameport.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/control.h>
#include <sound/pcm.h>
@@ -379,7 +381,7 @@ MODULE_PARM_DESC(lineio, "Line In to Rear Out (0 = auto, 1 = force).");
struct ensoniq {
spinlock_t reg_lock;
- struct semaphore src_mutex;
+ struct mutex src_mutex;
int irq;
@@ -609,7 +611,7 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
struct ensoniq *ensoniq = ac97->private_data;
unsigned int t, x;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
for (t = 0; t < POLL_COUNT; t++) {
if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
/* save the current state for latter */
@@ -634,11 +636,11 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
/* restore SRC reg */
snd_es1371_wait_src_ready(ensoniq);
outl(x, ES_REG(ensoniq, 1371_SMPRATE));
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
return;
}
}
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n",
ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
}
@@ -650,7 +652,7 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
unsigned int t, x, fail = 0;
__again:
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
for (t = 0; t < POLL_COUNT; t++) {
if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
/* save the current state for latter */
@@ -683,11 +685,11 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
/* now wait for the stinkin' data (RDY) */
for (t = 0; t < POLL_COUNT; t++) {
if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) {
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
return ES_1371_CODEC_READ(x);
}
}
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
if (++fail > 10) {
snd_printk(KERN_ERR "codec read timeout (final) "
"at 0x%lx, reg = 0x%x [0x%x]\n",
@@ -698,7 +700,7 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
goto __again;
}
}
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n",
ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
return 0;
@@ -717,7 +719,7 @@ static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int n, truncm, freq, result;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
n = rate / 3000;
if ((1 << n) & ((1 << 15) | (1 << 13) | (1 << 11) | (1 << 9)))
n--;
@@ -742,14 +744,14 @@ static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate)
snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff);
snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8);
snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8);
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
}
static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int freq, r;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
freq = ((rate << 15) + 1500) / 3000;
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P2 | ES_1371_DIS_R1)) |
@@ -763,14 +765,14 @@ static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate)
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P2 | ES_1371_DIS_R1));
outl(r, ES_REG(ensoniq, 1371_SMPRATE));
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
}
static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int freq, r;
- down(&ensoniq->src_mutex);
+ mutex_lock(&ensoniq->src_mutex);
freq = ((rate << 15) + 1500) / 3000;
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P1 | ES_1371_DIS_R1)) |
@@ -785,7 +787,7 @@ static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate)
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P1 | ES_1371_DIS_R1));
outl(r, ES_REG(ensoniq, 1371_SMPRATE));
- up(&ensoniq->src_mutex);
+ mutex_unlock(&ensoniq->src_mutex);
}
#endif /* CHIP1371 */
@@ -2123,7 +2125,7 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
return -ENOMEM;
}
spin_lock_init(&ensoniq->reg_lock);
- init_MUTEX(&ensoniq->src_mutex);
+ mutex_init(&ensoniq->src_mutex);
ensoniq->card = card;
ensoniq->pci = pci;
ensoniq->irq = -1;
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 3747a436f0c..6a265ab3894 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -103,6 +103,8 @@
#include <linux/slab.h>
#include <linux/gameport.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/mpu401.h>
@@ -569,7 +571,7 @@ struct es1968 {
u16 maestro_map[32];
int bobclient; /* active timer instancs */
int bob_freq; /* timer frequency */
- struct semaphore memory_mutex; /* memory lock */
+ struct mutex memory_mutex; /* memory lock */
/* APU states */
unsigned char apu[NR_APUS];
@@ -1356,13 +1358,13 @@ static int calc_available_memory_size(struct es1968 *chip)
struct list_head *p;
int max_size = 0;
- down(&chip->memory_mutex);
+ mutex_lock(&chip->memory_mutex);
list_for_each(p, &chip->buf_list) {
struct esm_memory *buf = list_entry(p, struct esm_memory, list);
if (buf->empty && buf->buf.bytes > max_size)
max_size = buf->buf.bytes;
}
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
if (max_size >= 128*1024)
max_size = 127*1024;
return max_size;
@@ -1375,20 +1377,20 @@ static struct esm_memory *snd_es1968_new_memory(struct es1968 *chip, int size)
struct list_head *p;
size = ((size + ESM_MEM_ALIGN - 1) / ESM_MEM_ALIGN) * ESM_MEM_ALIGN;
- down(&chip->memory_mutex);
+ mutex_lock(&chip->memory_mutex);
list_for_each(p, &chip->buf_list) {
buf = list_entry(p, struct esm_memory, list);
if (buf->empty && buf->buf.bytes >= size)
goto __found;
}
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
return NULL;
__found:
if (buf->buf.bytes > size) {
struct esm_memory *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
if (chunk == NULL) {
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
return NULL;
}
chunk->buf = buf->buf;
@@ -1400,7 +1402,7 @@ __found:
list_add(&chunk->list, &buf->list);
}
buf->empty = 0;
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
return buf;
}
@@ -1409,7 +1411,7 @@ static void snd_es1968_free_memory(struct es1968 *chip, struct esm_memory *buf)
{
struct esm_memory *chunk;
- down(&chip->memory_mutex);
+ mutex_lock(&chip->memory_mutex);
buf->empty = 1;
if (buf->list.prev != &chip->buf_list) {
chunk = list_entry(buf->list.prev, struct esm_memory, list);
@@ -1428,7 +1430,7 @@ static void snd_es1968_free_memory(struct es1968 *chip, struct esm_memory *buf)
kfree(chunk);
}
}
- up(&chip->memory_mutex);
+ mutex_unlock(&chip->memory_mutex);
}
static void snd_es1968_free_dmabuf(struct es1968 *chip)
@@ -2579,7 +2581,7 @@ static int __devinit snd_es1968_create(struct snd_card *card,
INIT_LIST_HEAD(&chip->buf_list);
INIT_LIST_HEAD(&chip->substream_list);
spin_lock_init(&chip->ac97_lock);
- init_MUTEX(&chip->memory_mutex);
+ mutex_init(&chip->memory_mutex);
tasklet_init(&chip->hwvol_tq, es1968_update_hw_volume, (unsigned long)chip);
chip->card = card;
chip->pci = pci;
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 4a6dd97deba..208a3341ec2 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -25,6 +25,7 @@
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include "hda_codec.h"
#include <sound/asoundef.h>
@@ -76,12 +77,12 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, int dire
unsigned int verb, unsigned int parm)
{
unsigned int res;
- down(&codec->bus->cmd_mutex);
+ mutex_lock(&codec->bus->cmd_mutex);
if (! codec->bus->ops.command(codec, nid, direct, verb, parm))
res = codec->bus->ops.get_response(codec);
else
res = (unsigned int)-1;
- up(&codec->bus->cmd_mutex);
+ mutex_unlock(&codec->bus->cmd_mutex);
return res;
}
@@ -101,9 +102,9 @@ int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct,
unsigned int verb, unsigned int parm)
{
int err;
- down(&codec->bus->cmd_mutex);
+ mutex_lock(&codec->bus->cmd_mutex);
err = codec->bus->ops.command(codec, nid, direct, verb, parm);
- up(&codec->bus->cmd_mutex);
+ mutex_unlock(&codec->bus->cmd_mutex);
return err;
}
@@ -371,7 +372,7 @@ int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
bus->modelname = temp->modelname;
bus->ops = temp->ops;
- init_MUTEX(&bus->cmd_mutex);
+ mutex_init(&bus->cmd_mutex);
INIT_LIST_HEAD(&bus->codec_list);
if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) {
@@ -523,7 +524,7 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
codec->bus = bus;
codec->addr = codec_addr;
- init_MUTEX(&codec->spdif_mutex);
+ mutex_init(&codec->spdif_mutex);
init_amp_hash(codec);
list_add_tail(&codec->list, &bus->codec_list);
@@ -881,12 +882,12 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_
unsigned long pval;
int err;
- down(&codec->spdif_mutex); /* reuse spdif_mutex */
+ mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
pval = kcontrol->private_value;
kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */
err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol);
kcontrol->private_value = pval;
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return err;
}
@@ -896,7 +897,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
unsigned long pval;
int i, indices, err = 0, change = 0;
- down(&codec->spdif_mutex); /* reuse spdif_mutex */
+ mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
pval = kcontrol->private_value;
indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT;
for (i = 0; i < indices; i++) {
@@ -907,7 +908,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
change |= err;
}
kcontrol->private_value = pval;
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return err < 0 ? err : change;
}
@@ -1011,7 +1012,7 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_c
unsigned short val;
int change;
- down(&codec->spdif_mutex);
+ mutex_lock(&codec->spdif_mutex);
codec->spdif_status = ucontrol->value.iec958.status[0] |
((unsigned int)ucontrol->value.iec958.status[1] << 8) |
((unsigned int)ucontrol->value.iec958.status[2] << 16) |
@@ -1026,7 +1027,7 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_c
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_2, val >> 8);
}
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return change;
}
@@ -1054,7 +1055,7 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol, struct sn
unsigned short val;
int change;
- down(&codec->spdif_mutex);
+ mutex_lock(&codec->spdif_mutex);
val = codec->spdif_ctls & ~1;
if (ucontrol->value.integer.value[0])
val |= 1;
@@ -1066,7 +1067,7 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol, struct sn
AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT |
AC_AMP_SET_OUTPUT | ((val & 1) ? 0 : 0x80));
}
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return change;
}
@@ -1150,13 +1151,13 @@ static int snd_hda_spdif_in_switch_put(struct snd_kcontrol *kcontrol, struct snd
unsigned int val = !!ucontrol->value.integer.value[0];
int change;
- down(&codec->spdif_mutex);
+ mutex_lock(&codec->spdif_mutex);
change = codec->spdif_in_enable != val;
if (change || codec->in_resume) {
codec->spdif_in_enable = val;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, val);
}
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return change;
}
@@ -1824,13 +1825,13 @@ int snd_hda_input_mux_put(struct hda_codec *codec, const struct hda_input_mux *i
*/
int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mout)
{
- down(&codec->spdif_mutex);
+ mutex_lock(&codec->spdif_mutex);
if (mout->dig_out_used) {
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return -EBUSY; /* already being used */
}
mout->dig_out_used = HDA_DIG_EXCLUSIVE;
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return 0;
}
@@ -1839,9 +1840,9 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mo
*/
int snd_hda_multi_out_dig_close(struct hda_codec *codec, struct hda_multi_out *mout)
{
- down(&codec->spdif_mutex);
+ mutex_lock(&codec->spdif_mutex);
mout->dig_out_used = 0;
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return 0;
}
@@ -1869,7 +1870,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_o
int chs = substream->runtime->channels;
int i;
- down(&codec->spdif_mutex);
+ mutex_lock(&codec->spdif_mutex);
if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) {
if (chs == 2 &&
snd_hda_is_supported_format(codec, mout->dig_out_nid, format) &&
@@ -1883,7 +1884,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_o
snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0);
}
}
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
/* front */
snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 0, format);
@@ -1914,12 +1915,12 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, struct hda_multi_o
snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0);
if (mout->hp_nid)
snd_hda_codec_setup_stream(codec, mout->hp_nid, 0, 0, 0);
- down(&codec->spdif_mutex);
+ mutex_lock(&codec->spdif_mutex);
if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) {
snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0);
mout->dig_out_used = 0;
}
- up(&codec->spdif_mutex);
+ mutex_unlock(&codec->spdif_mutex);
return 0;
}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 63e26c7a2b7..40520e9d5a4 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -438,7 +438,7 @@ struct hda_bus {
struct list_head codec_list;
struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1]; /* caddr -> codec */
- struct semaphore cmd_mutex;
+ struct mutex cmd_mutex;
/* unsolicited event queue */
struct hda_bus_unsolicited *unsol;
@@ -559,7 +559,7 @@ struct hda_codec {
int amp_info_size;
struct hda_amp_info *amp_info;
- struct semaphore spdif_mutex;
+ struct mutex spdif_mutex;
unsigned int spdif_status; /* IEC958 status bits */
unsigned short spdif_ctls; /* SPDIF control bits */
unsigned int spdif_in_enable; /* SPDIF input enable? */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b3f37e7b33c..dbed2644a19 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -43,6 +43,7 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/pci.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/initval.h>
#include "hda_codec.h"
@@ -297,7 +298,7 @@ struct azx {
/* locks */
spinlock_t reg_lock;
- struct semaphore open_mutex;
+ struct mutex open_mutex;
/* streams (x num_streams) */
struct azx_dev *azx_dev;
@@ -993,10 +994,10 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
unsigned long flags;
int err;
- down(&chip->open_mutex);
+ mutex_lock(&chip->open_mutex);
azx_dev = azx_assign_device(chip, substream->stream);
if (azx_dev == NULL) {
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return -EBUSY;
}
runtime->hw = azx_pcm_hw;
@@ -1008,7 +1009,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) {
azx_release_device(azx_dev);
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return err;
}
spin_lock_irqsave(&chip->reg_lock, flags);
@@ -1017,7 +1018,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
spin_unlock_irqrestore(&chip->reg_lock, flags);
runtime->private_data = azx_dev;
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return 0;
}
@@ -1029,14 +1030,14 @@ static int azx_pcm_close(struct snd_pcm_substream *substream)
struct azx_dev *azx_dev = get_azx_dev(substream);
unsigned long flags;
- down(&chip->open_mutex);
+ mutex_lock(&chip->open_mutex);
spin_lock_irqsave(&chip->reg_lock, flags);
azx_dev->substream = NULL;
azx_dev->running = 0;
spin_unlock_irqrestore(&chip->reg_lock, flags);
azx_release_device(azx_dev);
hinfo->ops.close(hinfo, apcm->codec, substream);
- up(&chip->open_mutex);
+ mutex_unlock(&chip->open_mutex);
return 0;
}
@@ -1408,7 +1409,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
}
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;
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 1ada1b075c9..5a3821ae93a 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -23,6 +23,8 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/pci.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "hda_codec.h"
#include "hda_local.h"
@@ -60,7 +62,7 @@ struct ad198x_spec {
/* PCM information */
struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */
- struct semaphore amp_mutex; /* PCM volume/mute control mutex */
+ struct mutex amp_mutex; /* PCM volume/mute control mutex */
unsigned int spdif_route;
/* dynamic controls, init_verbs and input_mux */
@@ -371,9 +373,9 @@ static int ad1986a_pcm_amp_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct ad198x_spec *ad = codec->spec;
- down(&ad->amp_mutex);
+ mutex_lock(&ad->amp_mutex);
snd_hda_mixer_amp_volume_get(kcontrol, ucontrol);
- up(&ad->amp_mutex);
+ mutex_unlock(&ad->amp_mutex);
return 0;
}
@@ -383,13 +385,13 @@ static int ad1986a_pcm_amp_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl
struct ad198x_spec *ad = codec->spec;
int i, change = 0;
- down(&ad->amp_mutex);
+ mutex_lock(&ad->amp_mutex);
for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) {
kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT);
change |= snd_hda_mixer_amp_volume_put(kcontrol, ucontrol);
}
kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT);
- up(&ad->amp_mutex);
+ mutex_unlock(&ad->amp_mutex);
return change;
}
@@ -400,9 +402,9 @@ static int ad1986a_pcm_amp_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct ad198x_spec *ad = codec->spec;
- down(&ad->amp_mutex);
+ mutex_lock(&ad->amp_mutex);
snd_hda_mixer_amp_switch_get(kcontrol, ucontrol);
- up(&ad->amp_mutex);
+ mutex_unlock(&ad->amp_mutex);
return 0;
}
@@ -412,13 +414,13 @@ static int ad1986a_pcm_amp_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
struct ad198x_spec *ad = codec->spec;
int i, change = 0;
- down(&ad->amp_mutex);
+ mutex_lock(&ad->amp_mutex);
for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) {
kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT);
change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
}
kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT);
- up(&ad->amp_mutex);
+ mutex_unlock(&ad->amp_mutex);
return change;
}
@@ -544,7 +546,7 @@ static int patch_ad1986a(struct hda_codec *codec)
if (spec == NULL)
return -ENOMEM;
- init_MUTEX(&spec->amp_mutex);
+ mutex_init(&spec->amp_mutex);
codec->spec = spec;
spec->multiout.max_channels = 6;
@@ -708,7 +710,7 @@ static int patch_ad1983(struct hda_codec *codec)
if (spec == NULL)
return -ENOMEM;
- init_MUTEX(&spec->amp_mutex);
+ mutex_init(&spec->amp_mutex);
codec->spec = spec;
spec->multiout.max_channels = 2;
@@ -854,7 +856,7 @@ static int patch_ad1981(struct hda_codec *codec)
if (spec == NULL)
return -ENOMEM;
- init_MUTEX(&spec->amp_mutex);
+ mutex_init(&spec->amp_mutex);
codec->spec = spec;
spec->multiout.max_channels = 2;
@@ -2032,7 +2034,7 @@ static int patch_ad1988(struct hda_codec *codec)
if (spec == NULL)
return -ENOMEM;
- init_MUTEX(&spec->amp_mutex);
+ mutex_init(&spec->amp_mutex);
codec->spec = spec;
if (codec->revision_id == AD1988A_REV2)
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 2175f672134..0f7f4d8263c 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -53,6 +53,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "ice1712.h"
@@ -210,14 +212,14 @@ static int aureon_ac97_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short vol;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F);
if (kcontrol->private_value & AUREON_AC97_STEREO)
ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -252,11 +254,11 @@ static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = aureon_ac97_read(ice, kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -288,11 +290,11 @@ static int aureon_ac97_micboost_get(struct snd_kcontrol *kcontrol, struct snd_ct
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -488,11 +490,11 @@ static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -557,9 +559,9 @@ static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -782,11 +784,11 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
val = val > PCM_MIN ? (val - PCM_MIN) : 0;
ucontrol->value.integer.value[0] = val;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -827,12 +829,12 @@ static int wm_adc_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
unsigned short val;
int i;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
val = wm_get(ice, WM_ADC_GAIN + i);
ucontrol->value.integer.value[i] = ~val>>5 & 0x1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -874,13 +876,13 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
int i, idx;
unsigned short vol;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
idx = WM_ADC_GAIN + i;
vol = wm_get(ice, idx) & 0x1f;
ucontrol->value.integer.value[i] = vol;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -951,11 +953,11 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
val = wm_get(ice, WM_ADC_MUX);
ucontrol->value.integer.value[0] = val & 7;
ucontrol->value.integer.value[1] = (val >> 4) & 7;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 9a51d34e681..4bbf1e2ae65 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -28,6 +28,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/cs8427.h>
#include <sound/asoundef.h>
@@ -130,13 +132,13 @@ static int ap_cs8427_sendbytes(struct snd_i2c_device *device, unsigned char *byt
int res = count;
unsigned char tmp;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = ap_cs8427_codec_select(ice);
ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */
while (count-- > 0)
ap_cs8427_write_byte(ice, *bytes++, tmp);
ap_cs8427_codec_deassert(ice, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return res;
}
@@ -147,13 +149,13 @@ static int ap_cs8427_readbytes(struct snd_i2c_device *device, unsigned char *byt
int res = count;
unsigned char tmp;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = ap_cs8427_codec_select(ice);
ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */
while (count-- > 0)
*bytes++ = ap_cs8427_read_byte(ice, tmp);
ap_cs8427_codec_deassert(ice, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return res;
}
@@ -180,7 +182,7 @@ static void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712 *ice, unsign
/* send byte to transmitter */
mask1 = ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK;
mask2 = ICE1712_DELTA_SPDIF_OUT_STAT_DATA;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
for (idx = 7; idx >= 0; idx--) {
tmp &= ~(mask1 | mask2);
@@ -194,7 +196,7 @@ static void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712 *ice, unsign
}
tmp &= ~mask1;
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
@@ -296,14 +298,14 @@ static void delta_1010_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
if (rate == 0) /* no hint - S/PDIF input is master, simply return */
return;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
tmp2 = tmp & ~ICE1712_DELTA_DFS;
if (rate > 48000)
tmp2 |= ICE1712_DELTA_DFS;
if (tmp != tmp2)
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp2);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
/*
@@ -318,9 +320,9 @@ static void delta_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
return;
/* check before reset ak4524 to avoid unnecessary clicks */
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
tmp2 = tmp & ~ICE1712_DELTA_DFS;
if (rate > 48000)
tmp2 |= ICE1712_DELTA_DFS;
@@ -329,12 +331,12 @@ static void delta_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
/* do it again */
snd_akm4xxx_reset(ak, 1);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ~ICE1712_DELTA_DFS;
if (rate > 48000)
tmp |= ICE1712_DELTA_DFS;
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
snd_akm4xxx_reset(ak, 0);
}
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c
index 3f2f918536f..3f27d04e7d3 100644
--- a/sound/pci/ice1712/hoontech.c
+++ b/sound/pci/ice1712/hoontech.c
@@ -27,6 +27,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "ice1712.h"
@@ -48,31 +50,31 @@ static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, un
static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* select box */
ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box);
@@ -115,12 +117,12 @@ static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, i
ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* select box */
ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box);
@@ -141,15 +143,15 @@ static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int
ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index ef6f18558c9..3156a313299 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -55,6 +55,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/cs8427.h>
#include <sound/info.h>
@@ -2557,9 +2558,9 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
cs8427_timeout = 1000;
ice->cs8427_timeout = cs8427_timeout;
spin_lock_init(&ice->reg_lock);
- init_MUTEX(&ice->gpio_mutex);
- init_MUTEX(&ice->i2c_mutex);
- init_MUTEX(&ice->open_mutex);
+ mutex_init(&ice->gpio_mutex);
+ mutex_init(&ice->i2c_mutex);
+ mutex_init(&ice->open_mutex);
ice->gpio.set_mask = snd_ice1712_set_gpio_mask;
ice->gpio.set_dir = snd_ice1712_set_gpio_dir;
ice->gpio.set_data = snd_ice1712_set_gpio_data;
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
index ce96b3bb653..d7416a83fca 100644
--- a/sound/pci/ice1712/ice1712.h
+++ b/sound/pci/ice1712/ice1712.h
@@ -334,7 +334,7 @@ struct snd_ice1712 {
unsigned int num_total_adcs; /* total ADCs */
unsigned int cur_rate; /* current rate */
- struct semaphore open_mutex;
+ struct mutex open_mutex;
struct snd_pcm_substream *pcm_reserved[4];
struct snd_pcm_hw_constraint_list *hw_rates; /* card-specific rate constraints */
@@ -342,7 +342,7 @@ struct snd_ice1712 {
struct snd_akm4xxx *akm;
struct snd_ice1712_spdif spdif;
- struct semaphore i2c_mutex; /* I2C mutex for ICE1724 registers */
+ struct mutex i2c_mutex; /* I2C mutex for ICE1724 registers */
struct snd_i2c_bus *i2c; /* I2C bus */
struct snd_i2c_device *cs8427; /* CS8427 I2C device */
unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */
@@ -360,7 +360,7 @@ struct snd_ice1712 {
void (*set_pro_rate)(struct snd_ice1712 *ice, unsigned int rate);
void (*i2s_mclk_changed)(struct snd_ice1712 *ice);
} gpio;
- struct semaphore gpio_mutex;
+ struct mutex gpio_mutex;
/* other board-specific data */
union {
@@ -423,7 +423,7 @@ static inline unsigned int snd_ice1712_gpio_read(struct snd_ice1712 *ice)
*/
static inline void snd_ice1712_save_gpio_status(struct snd_ice1712 *ice)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ice->gpio.saved[0] = ice->gpio.direction;
ice->gpio.saved[1] = ice->gpio.write_mask;
}
@@ -434,7 +434,7 @@ static inline void snd_ice1712_restore_gpio_status(struct snd_ice1712 *ice)
ice->gpio.set_mask(ice, ice->gpio.saved[1]);
ice->gpio.direction = ice->gpio.saved[0];
ice->gpio.write_mask = ice->gpio.saved[1];
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
/* for bit controls */
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 71f08c03601..fce616c2761 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -30,6 +30,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/mpu401.h>
@@ -487,7 +488,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
int i, chs;
chs = params_channels(hw_params);
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* mark surround channels */
if (substream == ice->playback_pro_substream) {
/* PDMA0 can be multi-channel up to 8 */
@@ -495,7 +496,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
for (i = 0; i < chs; i++) {
if (ice->pcm_reserved[i] &&
ice->pcm_reserved[i] != substream) {
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return -EBUSY;
}
ice->pcm_reserved[i] = substream;
@@ -510,7 +511,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
if (ice->playback_con_substream_ds[i] == substream) {
if (ice->pcm_reserved[i] &&
ice->pcm_reserved[i] != substream) {
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return -EBUSY;
}
ice->pcm_reserved[i] = substream;
@@ -518,7 +519,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
}
}
}
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0);
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
}
@@ -528,12 +529,12 @@ static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
int i;
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* unmark surround channels */
for (i = 0; i < 3; i++)
if (ice->pcm_reserved[i] == substream)
ice->pcm_reserved[i] = NULL;
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return snd_pcm_lib_free_pages(substream);
}
@@ -778,7 +779,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
set_rate_constraints(ice, substream);
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* calculate the currently available channels */
for (chs = 0; chs < 3; chs++) {
if (ice->pcm_reserved[chs])
@@ -788,7 +789,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
runtime->hw.channels_max = chs;
if (chs > 2) /* channels must be even */
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2);
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
VT1724_BUFFER_ALIGN);
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
@@ -1128,13 +1129,13 @@ static int snd_vt1724_playback_indep_open(struct snd_pcm_substream *substream)
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* already used by PDMA0? */
if (ice->pcm_reserved[substream->number]) {
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return -EBUSY; /* FIXME: should handle blocking mode properly */
}
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
runtime->private_data = &vt1724_playback_dma_regs[substream->number];
ice->playback_con_substream_ds[substream->number] = substream;
runtime->hw = snd_vt1724_2ch_stereo;
@@ -1978,12 +1979,12 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
{
unsigned char val;
- down(&ice->i2c_mutex);
+ mutex_lock(&ice->i2c_mutex);
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
outb(dev & ~VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
wait_i2c_busy(ice);
val = inb(ICEREG1724(ice, I2C_DATA));
- up(&ice->i2c_mutex);
+ mutex_unlock(&ice->i2c_mutex);
//printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
return val;
}
@@ -1991,14 +1992,14 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
unsigned char dev, unsigned char addr, unsigned char data)
{
- down(&ice->i2c_mutex);
+ mutex_lock(&ice->i2c_mutex);
wait_i2c_busy(ice);
//printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
outb(data, ICEREG1724(ice, I2C_DATA));
outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
wait_i2c_busy(ice);
- up(&ice->i2c_mutex);
+ mutex_unlock(&ice->i2c_mutex);
}
static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
@@ -2229,9 +2230,9 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
}
ice->vt1724 = 1;
spin_lock_init(&ice->reg_lock);
- init_MUTEX(&ice->gpio_mutex);
- init_MUTEX(&ice->open_mutex);
- init_MUTEX(&ice->i2c_mutex);
+ mutex_init(&ice->gpio_mutex);
+ mutex_init(&ice->open_mutex);
+ mutex_init(&ice->i2c_mutex);
ice->gpio.set_mask = snd_vt1724_set_gpio_mask;
ice->gpio.set_dir = snd_vt1724_set_gpio_dir;
ice->gpio.set_data = snd_vt1724_set_gpio_data;
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c
index ec3757834b9..502da1c8b5f 100644
--- a/sound/pci/ice1712/phase.c
+++ b/sound/pci/ice1712/phase.c
@@ -39,6 +39,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "ice1712.h"
@@ -273,9 +275,9 @@ static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -584,11 +586,11 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
val = val > PCM_MIN ? (val - PCM_MIN) : 0;
ucontrol->value.integer.value[0] = val;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index 0dccd7707a4..d23fb3fc213 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -27,6 +27,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/info.h>
@@ -124,13 +126,13 @@ static int wm_dac_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short val;
int i;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
val = wm_get(ice, WM_DAC_ATTEN_L + i) & 0xff;
val = val > DAC_MIN ? (val - DAC_MIN) : 0;
ucontrol->value.integer.value[i] = val;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -140,7 +142,7 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short oval, nval;
int i, idx, change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
nval = ucontrol->value.integer.value[i];
nval = (nval ? (nval + DAC_MIN) : 0) & 0xff;
@@ -152,7 +154,7 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
change = 1;
}
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -179,13 +181,13 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short val;
int i;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
val = wm_get(ice, WM_ADC_ATTEN_L + i) & 0xff;
val = val > ADC_MIN ? (val - ADC_MIN) : 0;
ucontrol->value.integer.value[i] = val;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -195,7 +197,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short ovol, nvol;
int i, idx, change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
nvol = ucontrol->value.integer.value[i];
nvol = nvol ? (nvol + ADC_MIN) : 0;
@@ -206,7 +208,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
change = 1;
}
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -227,9 +229,9 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int bit = kcontrol->private_value;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -240,7 +242,7 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short oval, nval;
int change;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
nval = oval = wm_get(ice, WM_ADC_MUX);
if (ucontrol->value.integer.value[0])
nval |= (1 << bit);
@@ -250,7 +252,7 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
if (change) {
wm_put(ice, WM_ADC_MUX, nval);
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -270,9 +272,9 @@ static int wm_bypass_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -282,7 +284,7 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
unsigned short val, oval;
int change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
val = oval = wm_get(ice, WM_OUT_MUX);
if (ucontrol->value.integer.value[0])
val |= 0x04;
@@ -292,7 +294,7 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
wm_put(ice, WM_OUT_MUX, val);
change = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -312,9 +314,9 @@ static int wm_chswap_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL1) & 0xf0) != 0x90;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -324,7 +326,7 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
unsigned short val, oval;
int change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
oval = wm_get(ice, WM_DAC_CTRL1);
val = oval & 0x0f;
if (ucontrol->value.integer.value[0])
@@ -336,7 +338,7 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
wm_put_nocache(ice, WM_DAC_CTRL1, val);
change = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -449,9 +451,9 @@ static int cs_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.enumerated.item[0] = ice->gpio.saved[0];
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -461,14 +463,14 @@ static int cs_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
unsigned char val;
int change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
if (ucontrol->value.enumerated.item[0] != ice->gpio.saved[0]) {
ice->gpio.saved[0] = ucontrol->value.enumerated.item[0] & 3;
val = 0x80 | (ice->gpio.saved[0] << 3);
spi_write(ice, CS_DEV, 0x04, val);
change = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -488,10 +490,10 @@ static int pontis_gpio_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_e
static int pontis_gpio_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
ucontrol->value.integer.value[0] = (~ice->gpio.write_mask & 0xffff) | 0x00f0;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -500,22 +502,22 @@ static int pontis_gpio_mask_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned int val;
int changed;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
val = (~ucontrol->value.integer.value[0] & 0xffff) | 0x00f0;
changed = val != ice->gpio.write_mask;
ice->gpio.write_mask = val;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return changed;
}
static int pontis_gpio_dir_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
ucontrol->value.integer.value[0] = ice->gpio.direction & 0xff0f;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -524,23 +526,23 @@ static int pontis_gpio_dir_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned int val;
int changed;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
val = ucontrol->value.integer.value[0] & 0xff0f;
changed = (val != ice->gpio.direction);
ice->gpio.direction = val;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return changed;
}
static int pontis_gpio_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
ucontrol->value.integer.value[0] = snd_ice1712_gpio_read(ice) & 0xffff;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -549,7 +551,7 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned int val, nval;
int changed = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
val = snd_ice1712_gpio_read(ice) & 0xffff;
@@ -558,7 +560,7 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
snd_ice1712_gpio_write(ice, nval);
changed = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return changed;
}
@@ -651,14 +653,14 @@ static void wm_proc_regs_write(struct snd_info_entry *entry, struct snd_info_buf
struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data;
char line[64];
unsigned int reg, val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
while (!snd_info_get_line(buffer, line, sizeof(line))) {
if (sscanf(line, "%x %x", &reg, &val) != 2)
continue;
if (reg <= 0x17 && val <= 0xffff)
wm_put(ice, reg, val);
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
@@ -666,12 +668,12 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data;
int reg, val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (reg = 0; reg <= 0x17; reg++) {
val = wm_get(ice, reg);
snd_iprintf(buffer, "%02x = %04x\n", reg, val);
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void wm_proc_init(struct snd_ice1712 *ice)
@@ -690,14 +692,14 @@ static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data;
int reg, val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (reg = 0; reg <= 0x26; reg++) {
val = spi_read(ice, CS_DEV, reg);
snd_iprintf(buffer, "%02x = %02x\n", reg, val);
}
val = spi_read(ice, CS_DEV, 0x7f);
snd_iprintf(buffer, "%02x = %02x\n", 0x7f, val);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void cs_proc_init(struct snd_ice1712 *ice)
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 4eddb512c12..4721c096335 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/info.h>
@@ -325,7 +326,7 @@ struct snd_korg1212 {
int irq;
spinlock_t lock;
- struct semaphore open_mutex;
+ struct mutex open_mutex;
struct timer_list timer; /* timer callback for checking ack of stop request */
int stop_pending_cnt; /* counter for stop pending check */
@@ -667,13 +668,13 @@ static int snd_korg1212_OpenCard(struct snd_korg1212 * korg1212)
{
K1212_DEBUG_PRINTK("K1212_DEBUG: OpenCard [%s] %d\n",
stateName[korg1212->cardState], korg1212->opencnt);
- down(&korg1212->open_mutex);
+ mutex_lock(&korg1212->open_mutex);
if (korg1212->opencnt++ == 0) {
snd_korg1212_TurnOffIdleMonitor(korg1212);
snd_korg1212_setCardState(korg1212, K1212_STATE_OPEN);
}
- up(&korg1212->open_mutex);
+ mutex_unlock(&korg1212->open_mutex);
return 1;
}
@@ -682,9 +683,9 @@ static int snd_korg1212_CloseCard(struct snd_korg1212 * korg1212)
K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard [%s] %d\n",
stateName[korg1212->cardState], korg1212->opencnt);
- down(&korg1212->open_mutex);
+ mutex_lock(&korg1212->open_mutex);
if (--(korg1212->opencnt)) {
- up(&korg1212->open_mutex);
+ mutex_unlock(&korg1212->open_mutex);
return 0;
}
@@ -695,7 +696,7 @@ static int snd_korg1212_CloseCard(struct snd_korg1212 * korg1212)
K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard - RC = %d [%s]\n",
rc, stateName[korg1212->cardState]);
if (rc != K1212_CMDRET_Success) {
- up(&korg1212->open_mutex);
+ mutex_unlock(&korg1212->open_mutex);
return 0;
}
} else if (korg1212->cardState > K1212_STATE_SETUP) {
@@ -707,7 +708,7 @@ static int snd_korg1212_CloseCard(struct snd_korg1212 * korg1212)
snd_korg1212_setCardState(korg1212, K1212_STATE_READY);
}
- up(&korg1212->open_mutex);
+ mutex_unlock(&korg1212->open_mutex);
return 0;
}
@@ -2179,7 +2180,7 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
init_waitqueue_head(&korg1212->wait);
spin_lock_init(&korg1212->lock);
- init_MUTEX(&korg1212->open_mutex);
+ mutex_init(&korg1212->open_mutex);
init_timer(&korg1212->timer);
korg1212->timer.function = snd_korg1212_timer_func;
korg1212->timer.data = (unsigned long)korg1212;
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index b218e1d20c7..e79fb264532 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -26,6 +26,7 @@
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/info.h>
@@ -589,7 +590,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
/* set up format for the stream */
format = params_format(hw);
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
/* update the stream levels */
if( stream->pcm_number <= MIXART_PCM_DIGITAL ) {
@@ -628,7 +629,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
bufferinfo[i].available_length,
subs->number);
}
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -700,7 +701,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
int err = 0;
int pcm_number;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
if ( pcm == chip->pcm ) {
pcm_number = MIXART_PCM_ANALOG;
@@ -758,7 +759,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
}
_exit_open:
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -775,7 +776,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
int err = 0;
int pcm_number;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
if ( pcm == chip->pcm ) {
pcm_number = MIXART_PCM_ANALOG;
@@ -836,7 +837,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
}
_exit_open:
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -849,7 +850,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
struct mixart_mgr *mgr = chip->mgr;
struct mixart_stream *stream = subs->runtime->private_data;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
snd_printdd("snd_mixart_close C%d/P%d/Sub%d\n", chip->chip_idx, stream->pcm_number, subs->number);
@@ -868,7 +869,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
stream->status = MIXART_STREAM_STATUS_FREE;
stream->substream = NULL;
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return 0;
}
@@ -1335,12 +1336,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
mgr->msg_fifo_writeptr = 0;
spin_lock_init(&mgr->msg_lock);
- init_MUTEX(&mgr->msg_mutex);
+ mutex_init(&mgr->msg_mutex);
init_waitqueue_head(&mgr->msg_sleep);
atomic_set(&mgr->msg_processed, 0);
/* init setup mutex*/
- init_MUTEX(&mgr->setup_mutex);
+ mutex_init(&mgr->setup_mutex);
/* init message taslket */
tasklet_init(&mgr->msg_taskq, snd_mixart_msg_tasklet, (unsigned long) mgr);
diff --git a/sound/pci/mixart/mixart.h b/sound/pci/mixart/mixart.h
index 3e84863ca02..561634d5c00 100644
--- a/sound/pci/mixart/mixart.h
+++ b/sound/pci/mixart/mixart.h
@@ -24,6 +24,7 @@
#define __SOUND_MIXART_H
#include <linux/interrupt.h>
+#include <linux/mutex.h>
#include <sound/pcm.h>
#define MIXART_DRIVER_VERSION 0x000100 /* 0.1.0 */
@@ -92,9 +93,9 @@ struct mixart_mgr {
spinlock_t lock; /* interrupt spinlock */
spinlock_t msg_lock; /* mailbox spinlock */
- struct semaphore msg_mutex; /* mutex for blocking_requests */
+ struct mutex msg_mutex; /* mutex for blocking_requests */
- struct semaphore setup_mutex; /* mutex used in hw_params, open and close */
+ struct mutex setup_mutex; /* mutex used in hw_params, open and close */
/* hardware interface */
unsigned int dsp_loaded; /* bit flags of loaded dsp indices */
@@ -107,7 +108,7 @@ struct mixart_mgr {
int sample_rate;
int ref_count_rate;
- struct semaphore mixer_mutex; /* mutex for mixer */
+ struct mutex mixer_mutex; /* mutex for mixer */
};
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
index 07c707d7ebb..406ac3a9d42 100644
--- a/sound/pci/mixart/mixart_core.c
+++ b/sound/pci/mixart/mixart_core.c
@@ -22,6 +22,8 @@
#include <sound/driver.h>
#include <linux/interrupt.h>
+#include <linux/mutex.h>
+
#include <asm/io.h>
#include <sound/core.h>
#include "mixart.h"
@@ -239,7 +241,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
wait_queue_t wait;
long timeout;
- down(&mgr->msg_mutex);
+ mutex_lock(&mgr->msg_mutex);
init_waitqueue_entry(&wait, current);
@@ -248,7 +250,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */
if (err) {
spin_unlock_irq(&mgr->msg_lock);
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return err;
}
@@ -260,7 +262,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
if (! timeout) {
/* error - no ack */
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame);
return -EIO;
}
@@ -276,7 +278,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
if( request->message_id != resp.message_id )
snd_printk(KERN_ERR "REPONSE ERROR!\n");
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return err;
}
@@ -292,7 +294,7 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL);
snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL);
- down(&mgr->msg_mutex);
+ mutex_lock(&mgr->msg_mutex);
init_waitqueue_entry(&wait, current);
@@ -301,7 +303,7 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, &notif_event); /* send and mark the notification event pending */
if(err) {
spin_unlock_irq(&mgr->msg_lock);
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return err;
}
@@ -313,12 +315,12 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
if (! timeout) {
/* error - no ack */
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
snd_printk(KERN_ERR "error: notification %x not received\n", notif_event);
return -EIO;
}
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return 0;
}
diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c
index 36a7e9ddfb1..ed47b732c10 100644
--- a/sound/pci/mixart/mixart_mixer.c
+++ b/sound/pci/mixart/mixart_mixer.c
@@ -24,6 +24,8 @@
#include <linux/time.h>
#include <linux/interrupt.h>
#include <linux/init.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "mixart.h"
#include "mixart_core.h"
@@ -353,7 +355,7 @@ static int mixart_analog_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_
static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if(kcontrol->private_value == 0) { /* playback */
ucontrol->value.integer.value[0] = chip->analog_playback_volume[0];
ucontrol->value.integer.value[1] = chip->analog_playback_volume[1];
@@ -361,7 +363,7 @@ static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
ucontrol->value.integer.value[0] = chip->analog_capture_volume[0];
ucontrol->value.integer.value[1] = chip->analog_capture_volume[1];
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -371,7 +373,7 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
int changed = 0;
int is_capture, i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
is_capture = (kcontrol->private_value != 0);
for(i=0; i<2; i++) {
int new_volume = ucontrol->value.integer.value[i];
@@ -382,7 +384,7 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
}
}
if(changed) mixart_update_analog_audio_level(chip, is_capture);
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -408,10 +410,10 @@ static int mixart_audio_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
{
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->analog_playback_active[0];
ucontrol->value.integer.value[1] = chip->analog_playback_active[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -419,7 +421,7 @@ static int mixart_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
{
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
int i, changed = 0;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for(i=0; i<2; i++) {
if(chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) {
chip->analog_playback_active[i] = ucontrol->value.integer.value[i];
@@ -427,7 +429,7 @@ static int mixart_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
}
}
if(changed) mixart_update_analog_audio_level(chip, 0); /* update playback levels */
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -817,7 +819,7 @@ static int mixart_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
int *stored_volume;
int is_capture = kcontrol->private_value & MIXART_VOL_REC_MASK;
int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if(is_capture) {
if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */
else stored_volume = chip->digital_capture_volume[0]; /* analog capture */
@@ -828,7 +830,7 @@ static int mixart_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
}
ucontrol->value.integer.value[0] = stored_volume[0];
ucontrol->value.integer.value[1] = stored_volume[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -841,7 +843,7 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK;
int* stored_volume;
int i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if(is_capture) {
if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */
else stored_volume = chip->digital_capture_volume[0]; /* analog capture */
@@ -860,7 +862,7 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
if(is_capture) mixart_update_capture_stream_level(chip, is_aes);
else mixart_update_playback_stream_level(chip, is_aes, idx);
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -880,12 +882,12 @@ static int mixart_pcm_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
snd_assert ( idx < MIXART_PLAYBACK_STREAMS );
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if(kcontrol->private_value & MIXART_VOL_AES_MASK) /* AES playback */
idx += MIXART_PLAYBACK_STREAMS;
ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0];
ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -897,7 +899,7 @@ static int mixart_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
int i, j;
snd_assert ( idx < MIXART_PLAYBACK_STREAMS );
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
j = idx;
if(is_aes) j += MIXART_PLAYBACK_STREAMS;
for(i=0; i<2; i++) {
@@ -907,7 +909,7 @@ static int mixart_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
}
}
if(changed) mixart_update_playback_stream_level(chip, is_aes, idx);
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -956,10 +958,10 @@ static int mixart_update_monitoring(struct snd_mixart* chip, int channel)
static int mixart_monitor_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->monitoring_volume[0];
ucontrol->value.integer.value[1] = chip->monitoring_volume[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -968,7 +970,7 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
int changed = 0;
int i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for(i=0; i<2; i++) {
if(chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) {
chip->monitoring_volume[i] = ucontrol->value.integer.value[i];
@@ -976,7 +978,7 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
changed = 1;
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -995,10 +997,10 @@ static struct snd_kcontrol_new mixart_control_monitor_vol = {
static int mixart_monitor_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->monitoring_active[0];
ucontrol->value.integer.value[1] = chip->monitoring_active[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -1007,7 +1009,7 @@ static int mixart_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
int changed = 0;
int i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for(i=0; i<2; i++) {
if(chip->monitoring_active[i] != ucontrol->value.integer.value[i]) {
chip->monitoring_active[i] = ucontrol->value.integer.value[i];
@@ -1029,7 +1031,7 @@ static int mixart_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return (changed != 0);
}
@@ -1059,7 +1061,7 @@ int snd_mixart_create_mixer(struct mixart_mgr *mgr)
struct snd_mixart *chip;
int err, i;
- init_MUTEX(&mgr->mixer_mutex); /* can be in another place */
+ mutex_init(&mgr->mixer_mutex); /* can be in another place */
for(i=0; i<mgr->num_cards; i++) {
struct snd_kcontrol_new temp;
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 0d0ff54f0fc..3a3ba6f547b 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -32,6 +32,8 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
@@ -235,7 +237,7 @@ struct nm256 {
int irq_acks;
irqreturn_t (*interrupt)(int, void *, struct pt_regs *);
int badintrcount; /* counter to check bogus interrupts */
- struct semaphore irq_mutex;
+ struct mutex irq_mutex;
struct nm256_stream streams[2];
@@ -459,32 +461,32 @@ snd_nm256_set_format(struct nm256 *chip, struct nm256_stream *s,
/* acquire interrupt */
static int snd_nm256_acquire_irq(struct nm256 *chip)
{
- down(&chip->irq_mutex);
+ mutex_lock(&chip->irq_mutex);
if (chip->irq < 0) {
if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ,
chip->card->driver, chip)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq);
- up(&chip->irq_mutex);
+ mutex_unlock(&chip->irq_mutex);
return -EBUSY;
}
chip->irq = chip->pci->irq;
}
chip->irq_acks++;
- up(&chip->irq_mutex);
+ mutex_unlock(&chip->irq_mutex);
return 0;
}
/* release interrupt */
static void snd_nm256_release_irq(struct nm256 *chip)
{
- down(&chip->irq_mutex);
+ mutex_lock(&chip->irq_mutex);
if (chip->irq_acks > 0)
chip->irq_acks--;
if (chip->irq_acks == 0 && chip->irq >= 0) {
free_irq(chip->irq, chip);
chip->irq = -1;
}
- up(&chip->irq_mutex);
+ mutex_unlock(&chip->irq_mutex);
}
/*
@@ -1407,7 +1409,7 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
chip->use_cache = use_cache;
spin_lock_init(&chip->reg_lock);
chip->irq = -1;
- init_MUTEX(&chip->irq_mutex);
+ mutex_init(&chip->irq_mutex);
/* store buffer sizes in bytes */
chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = playback_bufsize * 1024;
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index b2cba75b6b1..31a3e8e1b23 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -28,6 +28,8 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/info.h>
@@ -518,7 +520,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
struct timeval my_tv1, my_tv2;
do_gettimeofday(&my_tv1);
#endif
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
/* check the pipes concerned and build pipe_array */
for (i = 0; i < mgr->num_cards; i++) {
@@ -537,7 +539,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
}
}
if (capture_mask == 0 && playback_mask == 0) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
snd_printk(KERN_ERR "pcxhr_trigger_tasklet : no pipes\n");
return;
}
@@ -548,7 +550,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
/* synchronous stop of all the pipes concerned */
err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0);
if (err) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error stop pipes (P%x C%x)\n",
playback_mask, capture_mask);
return;
@@ -592,7 +594,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
/* synchronous start of all the pipes concerned */
err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1);
if (err) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error start pipes (P%x C%x)\n",
playback_mask, capture_mask);
return;
@@ -619,7 +621,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
}
spin_unlock_irqrestore(&mgr->lock, flags);
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
#ifdef CONFIG_SND_DEBUG_DETECT
do_gettimeofday(&my_tv2);
@@ -728,7 +730,7 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs)
}
*/
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
do {
/* if the stream was stopped before, format and buffer were reset */
@@ -755,7 +757,7 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs)
}
} while(0); /* do only once (so we can use break instead of goto) */
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -780,7 +782,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs,
/* set up format for the stream */
format = params_format(hw);
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
stream->channels = channels;
stream->format = format;
@@ -789,7 +791,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs,
/*
err = pcxhr_set_format(stream);
if(err) {
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
*/
@@ -801,7 +803,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs,
err = pcxhr_update_r_buffer(stream);
}
*/
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -847,7 +849,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
struct pcxhr_stream *stream;
int is_capture;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
/* copy the struct snd_pcm_hardware struct */
runtime->hw = pcxhr_caps;
@@ -871,7 +873,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
/* streams in use */
snd_printk(KERN_ERR "pcxhr_open chip%d subs%d in use\n",
chip->chip_idx, subs->number);
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return -EBUSY;
}
@@ -887,7 +889,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
&external_rate) ||
external_rate == 0) {
/* cannot detect the external clock rate */
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return -EBUSY;
}
runtime->hw.rate_min = runtime->hw.rate_max = external_rate;
@@ -905,7 +907,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
mgr->ref_count_rate++;
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return 0;
}
@@ -916,7 +918,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs)
struct pcxhr_mgr *mgr = chip->mgr;
struct pcxhr_stream *stream = subs->runtime->private_data;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
snd_printdd("pcxhr_close chip%d subs%d\n", chip->chip_idx, subs->number);
@@ -929,7 +931,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs)
stream->status = PCXHR_STREAM_STATUS_FREE;
stream->substream = NULL;
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return 0;
}
@@ -1264,7 +1266,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
spin_lock_init(&mgr->msg_lock);
/* init setup mutex*/
- init_MUTEX(&mgr->setup_mutex);
+ mutex_init(&mgr->setup_mutex);
/* init taslket */
tasklet_init(&mgr->msg_taskq, pcxhr_msg_tasklet, (unsigned long) mgr);
diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h
index 049f2b3f286..652064787a5 100644
--- a/sound/pci/pcxhr/pcxhr.h
+++ b/sound/pci/pcxhr/pcxhr.h
@@ -24,6 +24,7 @@
#define __SOUND_PCXHR_H
#include <linux/interrupt.h>
+#include <linux/mutex.h>
#include <sound/pcm.h>
#define PCXHR_DRIVER_VERSION 0x000804 /* 0.8.4 */
@@ -76,8 +77,8 @@ struct pcxhr_mgr {
spinlock_t lock; /* interrupt spinlock */
spinlock_t msg_lock; /* message spinlock */
- struct semaphore setup_mutex; /* mutex used in hw_params, open and close */
- struct semaphore mixer_mutex; /* mutex for mixer */
+ struct mutex setup_mutex; /* mutex used in hw_params, open and close */
+ struct mutex mixer_mutex; /* mutex for mixer */
/* hardware interface */
unsigned int dsp_loaded; /* bit flags of loaded dsp indices */
diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c
index 760e733ac25..94e63a1e90d 100644
--- a/sound/pci/pcxhr/pcxhr_mixer.c
+++ b/sound/pci/pcxhr/pcxhr_mixer.c
@@ -25,6 +25,7 @@
#include <linux/time.h>
#include <linux/interrupt.h>
#include <linux/init.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include "pcxhr.h"
#include "pcxhr_hwdep.h"
@@ -92,7 +93,7 @@ static int pcxhr_analog_vol_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if (kcontrol->private_value == 0) { /* playback */
ucontrol->value.integer.value[0] = chip->analog_playback_volume[0];
ucontrol->value.integer.value[1] = chip->analog_playback_volume[1];
@@ -100,7 +101,7 @@ static int pcxhr_analog_vol_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[0] = chip->analog_capture_volume[0];
ucontrol->value.integer.value[1] = chip->analog_capture_volume[1];
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -111,7 +112,7 @@ static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol,
int changed = 0;
int is_capture, i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
is_capture = (kcontrol->private_value != 0);
for (i = 0; i < 2; i++) {
int new_volume = ucontrol->value.integer.value[i];
@@ -123,7 +124,7 @@ static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol,
pcxhr_update_analog_audio_level(chip, is_capture, i);
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -150,10 +151,10 @@ static int pcxhr_audio_sw_get(struct snd_kcontrol *kcontrol,
{
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->analog_playback_active[0];
ucontrol->value.integer.value[1] = chip->analog_playback_active[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -162,7 +163,7 @@ static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol,
{
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
int i, changed = 0;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for(i = 0; i < 2; i++) {
if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) {
chip->analog_playback_active[i] = ucontrol->value.integer.value[i];
@@ -170,7 +171,7 @@ static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol,
pcxhr_update_analog_audio_level(chip, 0, i); /* update playback levels */
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -299,14 +300,14 @@ static int pcxhr_pcm_vol_get(struct snd_kcontrol *kcontrol,
int *stored_volume;
int is_capture = kcontrol->private_value;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if (is_capture)
stored_volume = chip->digital_capture_volume; /* digital capture */
else
stored_volume = chip->digital_playback_volume[idx]; /* digital playback */
ucontrol->value.integer.value[0] = stored_volume[0];
ucontrol->value.integer.value[1] = stored_volume[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -320,7 +321,7 @@ static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol,
int *stored_volume;
int i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if (is_capture)
stored_volume = chip->digital_capture_volume; /* digital capture */
else
@@ -335,7 +336,7 @@ static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol,
}
if (! is_capture && changed)
pcxhr_update_playback_stream_level(chip, idx); /* update playback volume */
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -356,10 +357,10 @@ static int pcxhr_pcm_sw_get(struct snd_kcontrol *kcontrol,
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0];
ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -370,7 +371,7 @@ static int pcxhr_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
int i, j;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
j = idx;
for (i = 0; i < 2; i++) {
if (chip->digital_playback_active[j][i] != ucontrol->value.integer.value[i]) {
@@ -380,7 +381,7 @@ static int pcxhr_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
}
if (changed)
pcxhr_update_playback_stream_level(chip, idx);
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -402,10 +403,10 @@ static int pcxhr_monitor_vol_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->monitoring_volume[0];
ucontrol->value.integer.value[1] = chip->monitoring_volume[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -416,7 +417,7 @@ static int pcxhr_monitor_vol_put(struct snd_kcontrol *kcontrol,
int changed = 0;
int i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for (i = 0; i < 2; i++) {
if (chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) {
chip->monitoring_volume[i] = ucontrol->value.integer.value[i];
@@ -426,7 +427,7 @@ static int pcxhr_monitor_vol_put(struct snd_kcontrol *kcontrol,
changed = 1;
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -446,10 +447,10 @@ static int pcxhr_monitor_sw_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->monitoring_active[0];
ucontrol->value.integer.value[1] = chip->monitoring_active[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -460,7 +461,7 @@ static int pcxhr_monitor_sw_put(struct snd_kcontrol *kcontrol,
int changed = 0;
int i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for (i = 0; i < 2; i++) {
if (chip->monitoring_active[i] != ucontrol->value.integer.value[i]) {
chip->monitoring_active[i] = ucontrol->value.integer.value[i];
@@ -474,7 +475,7 @@ static int pcxhr_monitor_sw_put(struct snd_kcontrol *kcontrol,
/* update right monitoring volume and mute */
pcxhr_update_audio_pipe_level(chip, 0, 1);
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return (changed != 0);
}
@@ -571,13 +572,13 @@ static int pcxhr_audio_src_put(struct snd_kcontrol *kcontrol,
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
int ret = 0;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
if (chip->audio_capture_source != ucontrol->value.enumerated.item[0]) {
chip->audio_capture_source = ucontrol->value.enumerated.item[0];
pcxhr_set_audio_source(chip);
ret = 1;
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return ret;
}
@@ -636,9 +637,9 @@ static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol,
struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
int rate, ret = 0;
- down(&mgr->mixer_mutex);
+ mutex_lock(&mgr->mixer_mutex);
if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) {
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
mgr->use_clock_type = ucontrol->value.enumerated.item[0];
if (mgr->use_clock_type)
pcxhr_get_external_clock(mgr, mgr->use_clock_type, &rate);
@@ -649,10 +650,10 @@ static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol,
if (mgr->sample_rate)
mgr->sample_rate = rate;
}
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
ret = 1; /* return 1 even if the set was not done. ok ? */
}
- up(&mgr->mixer_mutex);
+ mutex_unlock(&mgr->mixer_mutex);
return ret;
}
@@ -685,7 +686,7 @@ static int pcxhr_clock_rate_get(struct snd_kcontrol *kcontrol,
struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol);
int i, err, rate;
- down(&mgr->mixer_mutex);
+ mutex_lock(&mgr->mixer_mutex);
for(i = 0; i < 3 + mgr->capture_chips; i++) {
if (i == PCXHR_CLOCK_TYPE_INTERNAL)
rate = mgr->sample_rate_real;
@@ -696,7 +697,7 @@ static int pcxhr_clock_rate_get(struct snd_kcontrol *kcontrol,
}
ucontrol->value.integer.value[i] = rate;
}
- up(&mgr->mixer_mutex);
+ mutex_unlock(&mgr->mixer_mutex);
return 0;
}
@@ -765,7 +766,7 @@ static int pcxhr_iec958_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
unsigned char aes_bits;
int i, err;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for(i = 0; i < 5; i++) {
if (kcontrol->private_value == 0) /* playback */
aes_bits = chip->aes_bits[i];
@@ -776,7 +777,7 @@ static int pcxhr_iec958_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
}
ucontrol->value.iec958.status[i] = aes_bits;
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -828,14 +829,14 @@ static int pcxhr_iec958_put(struct snd_kcontrol *kcontrol,
int i, changed = 0;
/* playback */
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
for (i = 0; i < 5; i++) {
if (ucontrol->value.iec958.status[i] != chip->aes_bits[i]) {
pcxhr_iec958_update_byte(chip, i, ucontrol->value.iec958.status[i]);
changed = 1;
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -916,7 +917,7 @@ int pcxhr_create_mixer(struct pcxhr_mgr *mgr)
struct snd_pcxhr *chip;
int err, i;
- init_MUTEX(&mgr->mixer_mutex); /* can be in another place */
+ mutex_init(&mgr->mixer_mutex); /* can be in another place */
for (i = 0; i < mgr->num_cards; i++) {
struct snd_kcontrol_new temp;
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c
index cf09ea99755..46c6982c9e8 100644
--- a/sound/pci/trident/trident_memory.c
+++ b/sound/pci/trident/trident_memory.c
@@ -27,6 +27,8 @@
#include <asm/io.h>
#include <linux/pci.h>
#include <linux/time.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/trident.h>
@@ -201,16 +203,16 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident,
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
blk = search_empty(hdr, runtime->dma_bytes);
if (blk == NULL) {
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
if (lastpg(blk) - firstpg(blk) >= sgbuf->pages) {
snd_printk(KERN_ERR "page calculation doesn't match: allocated pages = %d, trident = %d/%d\n", sgbuf->pages, firstpg(blk), lastpg(blk));
__snd_util_mem_free(hdr, blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
@@ -221,12 +223,12 @@ snd_trident_alloc_sg_pages(struct snd_trident *trident,
unsigned long ptr = (unsigned long)sgbuf->table[idx].buf;
if (! is_valid_page(addr)) {
__snd_util_mem_free(hdr, blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
set_tlb_bus(trident, page, ptr, addr);
}
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return blk;
}
@@ -248,10 +250,10 @@ snd_trident_alloc_cont_pages(struct snd_trident *trident,
hdr = trident->tlb.memhdr;
snd_assert(hdr != NULL, return NULL);
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
blk = search_empty(hdr, runtime->dma_bytes);
if (blk == NULL) {
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
@@ -262,12 +264,12 @@ snd_trident_alloc_cont_pages(struct snd_trident *trident,
ptr += SNDRV_TRIDENT_PAGE_SIZE, addr += SNDRV_TRIDENT_PAGE_SIZE) {
if (! is_valid_page(addr)) {
__snd_util_mem_free(hdr, blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
set_tlb_bus(trident, page, ptr, addr);
}
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return blk;
}
@@ -300,13 +302,13 @@ int snd_trident_free_pages(struct snd_trident *trident,
snd_assert(blk != NULL, return -EINVAL);
hdr = trident->tlb.memhdr;
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
/* reset TLB entries */
for (page = firstpg(blk); page <= lastpg(blk); page++)
set_silent_tlb(trident, page);
/* free memory block */
__snd_util_mem_free(hdr, blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return 0;
}
@@ -332,18 +334,18 @@ snd_trident_synth_alloc(struct snd_trident *hw, unsigned int size)
struct snd_util_memblk *blk;
struct snd_util_memhdr *hdr = hw->tlb.memhdr;
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
blk = __snd_util_mem_alloc(hdr, size);
if (blk == NULL) {
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
if (synth_alloc_pages(hw, blk)) {
__snd_util_mem_free(hdr, blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return NULL;
}
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return blk;
}
@@ -356,10 +358,10 @@ snd_trident_synth_free(struct snd_trident *hw, struct snd_util_memblk *blk)
{
struct snd_util_memhdr *hdr = hw->tlb.memhdr;
- down(&hdr->block_mutex);
+ mutex_lock(&hdr->block_mutex);
synth_free_pages(hw, blk);
__snd_util_mem_free(hdr, blk);
- up(&hdr->block_mutex);
+ mutex_unlock(&hdr->block_mutex);
return 0;
}
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index c705af409b0..9b6d345b83a 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -24,6 +24,8 @@
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/firmware.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/control.h>
#include <asm/io.h>
@@ -861,10 +863,10 @@ static int vx_input_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
{
struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vx222 *chip = (struct snd_vx222 *)_chip;
- down(&_chip->mixer_mutex);
+ mutex_lock(&_chip->mixer_mutex);
ucontrol->value.integer.value[0] = chip->input_level[0];
ucontrol->value.integer.value[1] = chip->input_level[1];
- up(&_chip->mixer_mutex);
+ mutex_unlock(&_chip->mixer_mutex);
return 0;
}
@@ -872,16 +874,16 @@ static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
{
struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vx222 *chip = (struct snd_vx222 *)_chip;
- down(&_chip->mixer_mutex);
+ mutex_lock(&_chip->mixer_mutex);
if (chip->input_level[0] != ucontrol->value.integer.value[0] ||
chip->input_level[1] != ucontrol->value.integer.value[1]) {
chip->input_level[0] = ucontrol->value.integer.value[0];
chip->input_level[1] = ucontrol->value.integer.value[1];
vx2_set_input_level(chip);
- up(&_chip->mixer_mutex);
+ mutex_unlock(&_chip->mixer_mutex);
return 1;
}
- up(&_chip->mixer_mutex);
+ mutex_unlock(&_chip->mixer_mutex);
return 0;
}
@@ -907,14 +909,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_vx222 *chip = (struct snd_vx222 *)_chip;
- down(&_chip->mixer_mutex);
+ mutex_lock(&_chip->mixer_mutex);
if (chip->mic_level != ucontrol->value.integer.value[0]) {
chip->mic_level = ucontrol->value.integer.value[0];
vx2_set_input_level(chip);
- up(&_chip->mixer_mutex);
+ mutex_unlock(&_chip->mixer_mutex);
return 1;
}
- up(&_chip->mixer_mutex);
+ mutex_unlock(&_chip->mixer_mutex);
return 0;
}