mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
ALSA: sb: 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/20250829145300.5460-13-tiwai@suse.de
This commit is contained in:
@@ -265,14 +265,10 @@ static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file)
|
||||
*/
|
||||
static int snd_sb_csp_use(struct snd_sb_csp * p)
|
||||
{
|
||||
mutex_lock(&p->access_mutex);
|
||||
if (p->used) {
|
||||
mutex_unlock(&p->access_mutex);
|
||||
guard(mutex)(&p->access_mutex);
|
||||
if (p->used)
|
||||
return -EAGAIN;
|
||||
}
|
||||
p->used++;
|
||||
mutex_unlock(&p->access_mutex);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -282,10 +278,8 @@ static int snd_sb_csp_use(struct snd_sb_csp * p)
|
||||
*/
|
||||
static int snd_sb_csp_unuse(struct snd_sb_csp * p)
|
||||
{
|
||||
mutex_lock(&p->access_mutex);
|
||||
guard(mutex)(&p->access_mutex);
|
||||
p->used--;
|
||||
mutex_unlock(&p->access_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user