aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-01-07 09:36:31 -0500
committerJaroslav Kysela <perex@perex.cz>2010-01-07 09:48:13 -0500
commit1250932e48d3b698415b1f04775433cf1da688d6 (patch)
tree58d25383b6fa4e083f24dfc9d51ad4339ff7dece /sound/core/pcm_native.c
parentf240406babfe1526998e10583ea5eccc2676a433 (diff)
ALSA: pcm_lib - optimize wake_up() calls for PCM I/O
As noted by pl bossart <bossart.nospam@gmail.com>, the PCM I/O routines (snd_pcm_lib_write1, snd_pcm_lib_read1) should block wake_up() calls until all samples are not processed. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 8e777f71717c..27284f628361 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -516,6 +516,7 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
516 struct snd_pcm_sw_params *params) 516 struct snd_pcm_sw_params *params)
517{ 517{
518 struct snd_pcm_runtime *runtime; 518 struct snd_pcm_runtime *runtime;
519 int err;
519 520
520 if (PCM_RUNTIME_CHECK(substream)) 521 if (PCM_RUNTIME_CHECK(substream))
521 return -ENXIO; 522 return -ENXIO;
@@ -540,6 +541,7 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
540 if (params->silence_threshold > runtime->buffer_size) 541 if (params->silence_threshold > runtime->buffer_size)
541 return -EINVAL; 542 return -EINVAL;
542 } 543 }
544 err = 0;
543 snd_pcm_stream_lock_irq(substream); 545 snd_pcm_stream_lock_irq(substream);
544 runtime->tstamp_mode = params->tstamp_mode; 546 runtime->tstamp_mode = params->tstamp_mode;
545 runtime->period_step = params->period_step; 547 runtime->period_step = params->period_step;
@@ -553,10 +555,10 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
553 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 555 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
554 runtime->silence_size > 0) 556 runtime->silence_size > 0)
555 snd_pcm_playback_silence(substream, ULONG_MAX); 557 snd_pcm_playback_silence(substream, ULONG_MAX);
556 wake_up(&runtime->sleep); 558 err = snd_pcm_update_state(substream, runtime);
557 } 559 }
558 snd_pcm_stream_unlock_irq(substream); 560 snd_pcm_stream_unlock_irq(substream);
559 return 0; 561 return err;
560} 562}
561 563
562static int snd_pcm_sw_params_user(struct snd_pcm_substream *substream, 564static int snd_pcm_sw_params_user(struct snd_pcm_substream *substream,