diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-01-08 18:05:26 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 17:29:47 +0100 |
commit | d948035a928400ae127c873fbf771389bee18949 (patch) | |
tree | 1f8c98f21627e0ae1747c471dfbc3148923d80dd /sound/core/pcm_lib.c | |
parent | fa5717f2099aadb2083d5df4d19af8f9685fa03e (diff) | |
download | kernel_samsung_espresso10-d948035a928400ae127c873fbf771389bee18949.zip kernel_samsung_espresso10-d948035a928400ae127c873fbf771389bee18949.tar.gz kernel_samsung_espresso10-d948035a928400ae127c873fbf771389bee18949.tar.bz2 |
[ALSA] Remove PCM xfer_align sw params
The xfer_align sw_params parameter has never been used in a sane manner,
and no one understands what this does exactly. The current
implementation looks also buggy because it allows write of shorter size
than xfer_align. So, if you do partial writes, the write isn't actually
aligned at all.
Removing this parameter will make some pcm_lib_* code more readable
(and less buggy).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core/pcm_lib.c')
-rw-r--r-- | sound/core/pcm_lib.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index f9f9b3f..c1c1556 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1628,8 +1628,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, if (size == 0) return 0; - if (size > runtime->xfer_align) - size -= size % runtime->xfer_align; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -1657,9 +1655,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, avail = snd_pcm_playback_avail(runtime); if (!avail || (snd_pcm_running(substream) && - ((avail < runtime->control->avail_min && size > avail) || - (size >= runtime->xfer_align && - avail < runtime->xfer_align)))) { + (avail < runtime->control->avail_min && size > avail))) { wait_queue_t wait; enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; long tout; @@ -1731,8 +1727,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, break; } } - if (avail > runtime->xfer_align) - avail -= avail % runtime->xfer_align; frames = size > avail ? avail : size; cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; if (frames > cont) @@ -1900,8 +1894,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, if (size == 0) return 0; - if (size > runtime->xfer_align) - size -= size % runtime->xfer_align; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -1936,12 +1928,12 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, __draining: avail = snd_pcm_capture_avail(runtime); if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { - if (avail < runtime->xfer_align) { + if (!avail) { err = -EPIPE; goto _end_unlock; } - } else if ((avail < runtime->control->avail_min && size > avail) || - (size >= runtime->xfer_align && avail < runtime->xfer_align)) { + } else if (avail < runtime->control->avail_min && + size > avail) { wait_queue_t wait; enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; long tout; @@ -2014,8 +2006,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, break; } } - if (avail > runtime->xfer_align) - avail -= avail % runtime->xfer_align; frames = size > avail ? avail : size; cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; if (frames > cont) |