diff options
| author | Takashi Iwai <tiwai@suse.de> | 2025-08-29 17:13:15 +0200 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2025-09-01 13:54:26 +0200 |
| commit | 7a3dc0da931ea7c8a1f2e585a0465131f3c9e556 (patch) | |
| tree | 0f91d4f59ac718eb9533ac5fc005b3f703c60a96 | |
| parent | 95692e3c9fceecb821ba14b41773442d720fceaa (diff) | |
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
| -rw-r--r-- | sound/i2c/other/ak4113.c | 6 | ||||
| -rw-r--r-- | sound/i2c/other/ak4114.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c index c1f7447a4d11..fd54e44fe7d6 100644 --- a/sound/i2c/other/ak4113.c +++ b/sound/i2c/other/ak4113.c @@ -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); diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 7c493681f3cb..f4ded69bb0e4 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -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); |