1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-11 17:10:13 +00:00

ALSA: i2c: 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/20250829151335.7342-2-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2025-08-29 17:13:15 +02:00
parent 95692e3c9f
commit 7a3dc0da93
2 changed files with 6 additions and 6 deletions

View File

@ -127,9 +127,9 @@ void snd_ak4113_reinit(struct ak4113 *chip)
{
if (atomic_inc_return(&chip->wq_processing) == 1)
cancel_delayed_work_sync(&chip->work);
mutex_lock(&chip->reinit_mutex);
ak4113_init_regs(chip);
mutex_unlock(&chip->reinit_mutex);
scoped_guard(mutex, &chip->reinit_mutex) {
ak4113_init_regs(chip);
}
/* bring up statistics / event queing */
if (atomic_dec_and_test(&chip->wq_processing))
schedule_delayed_work(&chip->work, HZ / 10);

View File

@ -132,9 +132,9 @@ void snd_ak4114_reinit(struct ak4114 *chip)
{
if (atomic_inc_return(&chip->wq_processing) == 1)
cancel_delayed_work_sync(&chip->work);
mutex_lock(&chip->reinit_mutex);
ak4114_init_regs(chip);
mutex_unlock(&chip->reinit_mutex);
scoped_guard(mutex, &chip->reinit_mutex) {
ak4114_init_regs(chip);
}
/* bring up statistics / event queing */
if (atomic_dec_and_test(&chip->wq_processing))
schedule_delayed_work(&chip->work, HZ / 10);