summaryrefslogtreecommitdiff
path: root/sound/drivers
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-08-29 17:00:14 +0200
committerTakashi Iwai <tiwai@suse.de>2025-09-01 13:53:34 +0200
commit6a6da5ca9795d59f2e8b851f2b8d2ce8bc536c6e (patch)
treede7fef8fbeed93513cd6c30c935c3a8afc914be2 /sound/drivers
parent1ef2cb6b29c2c9c26b490ab5a1e8161923fb7798 (diff)
downloadlinux-6a6da5ca9795d59f2e8b851f2b8d2ce8bc536c6e.tar.gz
linux-6a6da5ca9795d59f2e8b851f2b8d2ce8bc536c6e.tar.bz2
linux-6a6da5ca9795d59f2e8b851f2b8d2ce8bc536c6e.zip
ALSA: opl3: 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/20250829150026.6379-4-tiwai@suse.de
Diffstat (limited to 'sound/drivers')
-rw-r--r--sound/drivers/opl3/opl3_seq.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c
index 9fc78b7fb780..8db77a81476c 100644
--- a/sound/drivers/opl3/opl3_seq.c
+++ b/sound/drivers/opl3/opl3_seq.c
@@ -40,13 +40,11 @@ int snd_opl3_synth_setup(struct snd_opl3 * opl3)
int idx;
struct snd_hwdep *hwdep = opl3->hwdep;
- mutex_lock(&hwdep->open_mutex);
- if (hwdep->used) {
- mutex_unlock(&hwdep->open_mutex);
- return -EBUSY;
+ scoped_guard(mutex, &hwdep->open_mutex) {
+ if (hwdep->used)
+ return -EBUSY;
+ hwdep->used++;
}
- hwdep->used++;
- mutex_unlock(&hwdep->open_mutex);
snd_opl3_reset(opl3);
@@ -81,9 +79,9 @@ void snd_opl3_synth_cleanup(struct snd_opl3 * opl3)
snd_opl3_reset(opl3);
hwdep = opl3->hwdep;
- mutex_lock(&hwdep->open_mutex);
- hwdep->used--;
- mutex_unlock(&hwdep->open_mutex);
+ scoped_guard(mutex, &hwdep->open_mutex) {
+ hwdep->used--;
+ }
wake_up(&hwdep->open_wait);
}