Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+3 -12
+2 -8
sound/core/seq/oss/seq_oss_readq.c
··· 140 140 int 141 141 snd_seq_oss_readq_put_event(struct seq_oss_readq *q, union evrec *ev) 142 142 { 143 - unsigned long flags; 144 - 145 - spin_lock_irqsave(&q->lock, flags); 146 - if (q->qlen >= q->maxlen - 1) { 147 - spin_unlock_irqrestore(&q->lock, flags); 143 + guard(spinlock_irqsave)(&q->lock); 144 + if (q->qlen >= q->maxlen - 1) 148 145 return -ENOMEM; 149 - } 150 146 151 147 memcpy(&q->q[q->tail], ev, sizeof(*ev)); 152 148 q->tail = (q->tail + 1) % q->maxlen; ··· 150 154 151 155 /* wake up sleeper */ 152 156 wake_up(&q->midi_sleep); 153 - 154 - spin_unlock_irqrestore(&q->lock, flags); 155 157 156 158 return 0; 157 159 }
+1 -4
sound/core/seq/oss/seq_oss_writeq.c
··· 122 122 void 123 123 snd_seq_oss_writeq_wakeup(struct seq_oss_writeq *q, abstime_t time) 124 124 { 125 - unsigned long flags; 126 - 127 - spin_lock_irqsave(&q->sync_lock, flags); 125 + guard(spinlock_irqsave)(&q->sync_lock); 128 126 q->sync_time = time; 129 127 q->sync_event_put = 0; 130 128 wake_up(&q->sync_sleep); 131 - spin_unlock_irqrestore(&q->sync_lock, flags); 132 129 } 133 130 134 131