summaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-08-29 16:43:35 +0200
committerTakashi Iwai <tiwai@suse.de>2025-09-01 13:52:43 +0200
commitdde5decc43de96ff508815e359aef6edcef68634 (patch)
tree51d2e391b86ac061592a4583551056e04528aa6d /sound/pci
parent9d60b94f13d3d1e7251b86e838920d0b0ad4947f (diff)
ALSA: vx222: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code simplification. Only code refactoring, and no behavior change. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250829144342.4290-61-tiwai@suse.de
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/vx222/vx222_ops.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index 3e7e928b24f8..b6459dbdb1b0 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -868,10 +868,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 = to_vx222(_chip);
- mutex_lock(&_chip->mixer_mutex);
+
+ guard(mutex)(&_chip->mixer_mutex);
ucontrol->value.integer.value[0] = chip->input_level[0];
ucontrol->value.integer.value[1] = chip->input_level[1];
- mutex_unlock(&_chip->mixer_mutex);
return 0;
}
@@ -885,16 +885,14 @@ static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
if (ucontrol->value.integer.value[1] < 0 ||
ucontrol->value.integer.value[1] > MIC_LEVEL_MAX)
return -EINVAL;
- mutex_lock(&_chip->mixer_mutex);
+ guard(mutex)(&_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);
- mutex_unlock(&_chip->mixer_mutex);
return 1;
}
- mutex_unlock(&_chip->mixer_mutex);
return 0;
}
@@ -923,14 +921,12 @@ static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
if (ucontrol->value.integer.value[0] < 0 ||
ucontrol->value.integer.value[0] > MIC_LEVEL_MAX)
return -EINVAL;
- mutex_lock(&_chip->mixer_mutex);
+ guard(mutex)(&_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);
- mutex_unlock(&_chip->mixer_mutex);
return 1;
}
- mutex_unlock(&_chip->mixer_mutex);
return 0;
}