diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-01-08 12:05:26 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:29:47 -0500 |
commit | d948035a928400ae127c873fbf771389bee18949 (patch) | |
tree | 1f8c98f21627e0ae1747c471dfbc3148923d80dd /sound/core/pcm_lib.c | |
parent | fa5717f2099aadb2083d5df4d19af8f9685fa03e (diff) |
[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 f9f9b3fe956e..c1c1556105c0 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, | |||
1628 | 1628 | ||
1629 | if (size == 0) | 1629 | if (size == 0) |
1630 | return 0; | 1630 | return 0; |
1631 | if (size > runtime->xfer_align) | ||
1632 | size -= size % runtime->xfer_align; | ||
1633 | 1631 | ||
1634 | snd_pcm_stream_lock_irq(substream); | 1632 | snd_pcm_stream_lock_irq(substream); |
1635 | switch (runtime->status->state) { | 1633 | switch (runtime->status->state) { |
@@ -1657,9 +1655,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, | |||
1657 | avail = snd_pcm_playback_avail(runtime); | 1655 | avail = snd_pcm_playback_avail(runtime); |
1658 | if (!avail || | 1656 | if (!avail || |
1659 | (snd_pcm_running(substream) && | 1657 | (snd_pcm_running(substream) && |
1660 | ((avail < runtime->control->avail_min && size > avail) || | 1658 | (avail < runtime->control->avail_min && size > avail))) { |
1661 | (size >= runtime->xfer_align && | ||
1662 | avail < runtime->xfer_align)))) { | ||
1663 | wait_queue_t wait; | 1659 | wait_queue_t wait; |
1664 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; | 1660 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; |
1665 | long tout; | 1661 | long tout; |
@@ -1731,8 +1727,6 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, | |||
1731 | break; | 1727 | break; |
1732 | } | 1728 | } |
1733 | } | 1729 | } |
1734 | if (avail > runtime->xfer_align) | ||
1735 | avail -= avail % runtime->xfer_align; | ||
1736 | frames = size > avail ? avail : size; | 1730 | frames = size > avail ? avail : size; |
1737 | cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; | 1731 | cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; |
1738 | if (frames > cont) | 1732 | if (frames > cont) |
@@ -1900,8 +1894,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
1900 | 1894 | ||
1901 | if (size == 0) | 1895 | if (size == 0) |
1902 | return 0; | 1896 | return 0; |
1903 | if (size > runtime->xfer_align) | ||
1904 | size -= size % runtime->xfer_align; | ||
1905 | 1897 | ||
1906 | snd_pcm_stream_lock_irq(substream); | 1898 | snd_pcm_stream_lock_irq(substream); |
1907 | switch (runtime->status->state) { | 1899 | switch (runtime->status->state) { |
@@ -1936,12 +1928,12 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
1936 | __draining: | 1928 | __draining: |
1937 | avail = snd_pcm_capture_avail(runtime); | 1929 | avail = snd_pcm_capture_avail(runtime); |
1938 | if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { | 1930 | if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { |
1939 | if (avail < runtime->xfer_align) { | 1931 | if (!avail) { |
1940 | err = -EPIPE; | 1932 | err = -EPIPE; |
1941 | goto _end_unlock; | 1933 | goto _end_unlock; |
1942 | } | 1934 | } |
1943 | } else if ((avail < runtime->control->avail_min && size > avail) || | 1935 | } else if (avail < runtime->control->avail_min && |
1944 | (size >= runtime->xfer_align && avail < runtime->xfer_align)) { | 1936 | size > avail) { |
1945 | wait_queue_t wait; | 1937 | wait_queue_t wait; |
1946 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; | 1938 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; |
1947 | long tout; | 1939 | long tout; |
@@ -2014,8 +2006,6 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, | |||
2014 | break; | 2006 | break; |
2015 | } | 2007 | } |
2016 | } | 2008 | } |
2017 | if (avail > runtime->xfer_align) | ||
2018 | avail -= avail % runtime->xfer_align; | ||
2019 | frames = size > avail ? avail : size; | 2009 | frames = size > avail ? avail : size; |
2020 | cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; | 2010 | cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; |
2021 | if (frames > cont) | 2011 | if (frames > cont) |