Commit 4b24b960 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: seq: Align temporary re-locking with irqsave version

In a few places in sequencer core, we temporarily unlock / re-lock the
pool spin lock while waiting for the allocation in the blocking mode.
There spin_unlock_irq() / spin_lock_irq() pairs are called while
initially spin_lock_irqsave() is used (and spin_lock_irqrestore() at
the end of the function again).  This is likely OK for now, but it's a
bit confusing and error-prone.

This patch replaces these temporary relocking lines with the irqsave
variant to make the lock/unlock sequence more consistently.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fd7ae83d
...@@ -195,9 +195,9 @@ int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, ...@@ -195,9 +195,9 @@ int snd_seq_fifo_cell_out(struct snd_seq_fifo *f,
} }
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&f->input_sleep, &wait); add_wait_queue(&f->input_sleep, &wait);
spin_unlock_irq(&f->lock); spin_unlock_irqrestore(&f->lock, flags);
schedule(); schedule();
spin_lock_irq(&f->lock); spin_lock_irqsave(&f->lock, flags);
remove_wait_queue(&f->input_sleep, &wait); remove_wait_queue(&f->input_sleep, &wait);
if (signal_pending(current)) { if (signal_pending(current)) {
spin_unlock_irqrestore(&f->lock, flags); spin_unlock_irqrestore(&f->lock, flags);
......
...@@ -244,13 +244,13 @@ static int snd_seq_cell_alloc(struct snd_seq_pool *pool, ...@@ -244,13 +244,13 @@ static int snd_seq_cell_alloc(struct snd_seq_pool *pool,
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&pool->output_sleep, &wait); add_wait_queue(&pool->output_sleep, &wait);
spin_unlock_irq(&pool->lock); spin_unlock_irqrestore(&pool->lock, flags);
if (mutexp) if (mutexp)
mutex_unlock(mutexp); mutex_unlock(mutexp);
schedule(); schedule();
if (mutexp) if (mutexp)
mutex_lock(mutexp); mutex_lock(mutexp);
spin_lock_irq(&pool->lock); spin_lock_irqsave(&pool->lock, flags);
remove_wait_queue(&pool->output_sleep, &wait); remove_wait_queue(&pool->output_sleep, &wait);
/* interrupted? */ /* interrupted? */
if (signal_pending(current)) { if (signal_pending(current)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment