diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-05-27 08:02:59 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-27 08:02:59 +0200 |
commit | d1227e3fe0c63a258db855f4f1536b0b34cd8725 (patch) | |
tree | d1fba37609a1b357eeb1051d0a6709385dd3bf90 /sound/core/pcm_lib.c | |
parent | 9477c58e3308f54a108a5d1eb9621830b329b0ca (diff) | |
parent | 78fa2c4d2465d014e67d3e12d948425856587251 (diff) |
Merge branch 'fix/misc' into for-linus
Diffstat (limited to 'sound/core/pcm_lib.c')
-rw-r--r-- | sound/core/pcm_lib.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index abfeff1611c..f1341308bed 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1756,8 +1756,18 @@ static int wait_for_avail(struct snd_pcm_substream *substream, wait_queue_t wait; int err = 0; snd_pcm_uframes_t avail = 0; - long tout; - + long wait_time, tout; + + if (runtime->no_period_wakeup) + wait_time = MAX_SCHEDULE_TIMEOUT; + else { + wait_time = 10; + if (runtime->rate) { + long t = runtime->period_size * 2 / runtime->rate; + wait_time = max(t, wait_time); + } + wait_time = msecs_to_jiffies(wait_time * 1000); + } init_waitqueue_entry(&wait, current); add_wait_queue(&runtime->tsleep, &wait); for (;;) { @@ -1765,9 +1775,8 @@ static int wait_for_avail(struct snd_pcm_substream *substream, err = -ERESTARTSYS; break; } - set_current_state(TASK_INTERRUPTIBLE); snd_pcm_stream_unlock_irq(substream); - tout = schedule_timeout(msecs_to_jiffies(10000)); + tout = schedule_timeout_interruptible(wait_time); snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { case SNDRV_PCM_STATE_SUSPENDED: |