ALSA: misc: Use guard() for spin locks
Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250829151335.7342-20-tiwai@suse.depull/476/head
parent
69f374931f
commit
b8e1684163
|
|
@ -127,35 +127,30 @@ int snd_fasync_helper(int fd, struct file *file, int on,
|
|||
INIT_LIST_HEAD(&fasync->list);
|
||||
}
|
||||
|
||||
spin_lock_irq(&snd_fasync_lock);
|
||||
scoped_guard(spinlock_irq, &snd_fasync_lock) {
|
||||
if (*fasyncp) {
|
||||
kfree(fasync);
|
||||
fasync = *fasyncp;
|
||||
} else {
|
||||
if (!fasync) {
|
||||
spin_unlock_irq(&snd_fasync_lock);
|
||||
if (!fasync)
|
||||
return 0;
|
||||
}
|
||||
*fasyncp = fasync;
|
||||
}
|
||||
fasync->on = on;
|
||||
spin_unlock_irq(&snd_fasync_lock);
|
||||
}
|
||||
return fasync_helper(fd, file, on, &fasync->fasync);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_fasync_helper);
|
||||
|
||||
void snd_kill_fasync(struct snd_fasync *fasync, int signal, int poll)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (!fasync || !fasync->on)
|
||||
return;
|
||||
spin_lock_irqsave(&snd_fasync_lock, flags);
|
||||
guard(spinlock_irqsave)(&snd_fasync_lock);
|
||||
fasync->signal = signal;
|
||||
fasync->poll = poll;
|
||||
list_move(&fasync->list, &snd_fasync_list);
|
||||
schedule_work(&snd_fasync_work);
|
||||
spin_unlock_irqrestore(&snd_fasync_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_kill_fasync);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue