diff options
| author | Takashi Iwai <tiwai@suse.de> | 2025-08-29 17:42:47 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2025-09-01 14:52:39 +0300 |
| commit | ca10ce1caf1922e5fdd62ccaf525d96bd2eeb611 (patch) | |
| tree | 7cfaefaba8c047efc2dc528ddb590940f940a05d | |
| parent | 5f7e725e023ec91aa55d73de1889e1660fd62536 (diff) | |
| download | linux-ca10ce1caf1922e5fdd62ccaf525d96bd2eeb611.tar.xz | |
ALSA: aw2: 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-13-tiwai@suse.de
| -rw-r--r-- | sound/pci/aw2/aw2-alsa.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 1d7aab14579e..bf9b3c84f554 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c @@ -347,7 +347,7 @@ static int snd_aw2_pcm_prepare_playback(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; unsigned long period_size, buffer_size; - mutex_lock(&chip->mtx); + guard(mutex)(&chip->mtx); period_size = snd_pcm_lib_period_bytes(substream); buffer_size = snd_pcm_lib_buffer_bytes(substream); @@ -363,8 +363,6 @@ static int snd_aw2_pcm_prepare_playback(struct snd_pcm_substream *substream) snd_pcm_period_elapsed, (void *)substream); - mutex_unlock(&chip->mtx); - return 0; } @@ -376,7 +374,7 @@ static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; unsigned long period_size, buffer_size; - mutex_lock(&chip->mtx); + guard(mutex)(&chip->mtx); period_size = snd_pcm_lib_period_bytes(substream); buffer_size = snd_pcm_lib_buffer_bytes(substream); @@ -392,8 +390,6 @@ static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream) snd_pcm_period_elapsed, (void *)substream); - mutex_unlock(&chip->mtx); - return 0; } |
