summaryrefslogtreecommitdiff
path: root/sound/pci/ac97/ak4531_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ac97/ak4531_codec.c')
-rw-r--r--sound/pci/ac97/ak4531_codec.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c
index dcfb5036ff8b..0fb7b3407312 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;