ASoC: codecs: wm971x: Use guard() for mutex locks

Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.

Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260731030648.8706-25-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-07-31 10:06:46 +07:00 committed by Mark Brown
parent e2f1f4ad30
commit a65ce15323
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 4 additions and 6 deletions

View File

@ -6,6 +6,7 @@
* Author: Liam Girdwood <lrg@slimlogic.co.uk>
*/
#include <linux/cleanup.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mfd/wm97xx.h>
@ -229,7 +230,7 @@ static int wm9712_hp_mixer_put(struct snd_kcontrol *kcontrol,
shift = mc->shift & 0xff;
mask = 1 << shift;
mutex_lock(&wm9712->lock);
guard(mutex)(&wm9712->lock);
old = wm9712->hp_mixer[mixer];
if (ucontrol->value.integer.value[0])
wm9712->hp_mixer[mixer] |= mask;
@ -251,8 +252,6 @@ static int wm9712_hp_mixer_put(struct snd_kcontrol *kcontrol,
&update);
}
mutex_unlock(&wm9712->lock);
return change;
}

View File

@ -11,6 +11,7 @@
* o Support for DAPM
*/
#include <linux/cleanup.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mfd/wm97xx.h>
@ -238,7 +239,7 @@ static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol,
shift = mc->shift & 0xff;
mask = (1 << shift);
mutex_lock(&wm9713->lock);
guard(mutex)(&wm9713->lock);
old = wm9713->hp_mixer[mixer];
if (ucontrol->value.integer.value[0])
wm9713->hp_mixer[mixer] |= mask;
@ -260,8 +261,6 @@ static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol,
&update);
}
mutex_unlock(&wm9713->lock);
return change;
}