Skip to content

Commit 37151a4

Browse files
ytsunashimatiwai
authored andcommitted
ALSA: pcm: fix lost wakeup event scenarios in snd_pcm_drain
lost wakeup can occur after enabling irq, therefore put task into interruptible before enabling interrupts, without this change, task can be put to sleep and snd_pcm_drain will delay Fixes: f2b3614 ("ALSA: PCM - Don't check DMA time-out too shortly") Signed-off-by: Yuki Tsunashima <[email protected]> Signed-off-by: Suresh Udipi <[email protected]> [ported from 4.9] Signed-off-by: Adam Miartus <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 74bf71e commit 37151a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sound/core/pcm_native.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
18731873
if (!to_check)
18741874
break; /* all drained */
18751875
init_waitqueue_entry(&wait, current);
1876+
set_current_state(TASK_INTERRUPTIBLE);
18761877
add_wait_queue(&to_check->sleep, &wait);
18771878
snd_pcm_stream_unlock_irq(substream);
18781879
if (runtime->no_period_wakeup)
@@ -1885,7 +1886,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
18851886
}
18861887
tout = msecs_to_jiffies(tout * 1000);
18871888
}
1888-
tout = schedule_timeout_interruptible(tout);
1889+
tout = schedule_timeout(tout);
18891890

18901891
snd_pcm_stream_lock_irq(substream);
18911892
group = snd_pcm_stream_group_ref(substream);

0 commit comments

Comments
 (0)