mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
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
This commit is contained in:
parent
5f7e725e02
commit
ca10ce1caf
1 changed files with 2 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue