mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
ALSA: seq: oss/rw: Cleanup with guard
Replace the manual spin 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/20250827080520.7544-12-tiwai@suse.de
This commit is contained in:
parent
80ccbe91ad
commit
da24e6b3c2
|
|
@ -140,13 +140,9 @@ int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
|
|||
int
|
||||
snd_seq_oss_readq_put_event(struct seq_oss_readq *q, union evrec *ev)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&q->lock, flags);
|
||||
if (q->qlen >= q->maxlen - 1) {
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
guard(spinlock_irqsave)(&q->lock);
|
||||
if (q->qlen >= q->maxlen - 1)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(&q->q[q->tail], ev, sizeof(*ev));
|
||||
q->tail = (q->tail + 1) % q->maxlen;
|
||||
|
|
@ -155,8 +151,6 @@ snd_seq_oss_readq_put_event(struct seq_oss_readq *q, union evrec *ev)
|
|||
/* wake up sleeper */
|
||||
wake_up(&q->midi_sleep);
|
||||
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,13 +122,10 @@ snd_seq_oss_writeq_sync(struct seq_oss_writeq *q)
|
|||
void
|
||||
snd_seq_oss_writeq_wakeup(struct seq_oss_writeq *q, abstime_t time)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&q->sync_lock, flags);
|
||||
guard(spinlock_irqsave)(&q->sync_lock);
|
||||
q->sync_time = time;
|
||||
q->sync_event_put = 0;
|
||||
wake_up(&q->sync_sleep);
|
||||
spin_unlock_irqrestore(&q->sync_lock, flags);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user