Skip to contentSkip to conversation

ALSA: compress_core: don't return -EBADFD from poll if paused

PATCH In review Richard Fitzgerald 3 participants 3 messages Oct 22, 2013 – Nov 12, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: compress_core: don't return -EBADFD from poll if paused

Pausing audio playback is not an illegal state so it doesn't seem sensible for poll() to return -EBADFD on a paused stream. There's also no reason to assume that we can't write more data to the DSP while playback is paused. Remove the -EBADFD so that a stream in paused state will still report the buffer availability from poll(). It is up to the user process to manage its state so that it knows whether it is paused or not.

---
 sound/core/compress_offload.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
sound/core/compress_offload.c +1 -2
index bea523a..30ca133 100644
@@ -384,8 +384,7 @@ static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
 		return -EFAULT;
 
 	mutex_lock(&stream->device->lock);
-	if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED ||
-			stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
+	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
 		retval = -EBADFD;
 		goto out;
 	}
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 9 lines · Richard Fitzgerald

Pausing audio playback is not an illegal state so it doesn't seem sensible for poll() to return -EBADFD on a paused stream. There's also no reason to assume that we can't write more data to the DSP while playback is paused. Remove the -EBADFD so that a stream in paused state will still report the buffer availability from poll(). It is up to the user process to manage its state so that it knows whether it is paused or not.

Acked-by VInod Koul <[email protected]>

Takashi, looks like I missed checking this earlier..

--
~Vinod

Quoted 21 lines
---
 sound/core/compress_offload.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
sound/core/compress_offload.c +1 -2
index bea523a..30ca133 100644
@@ -384,8 +384,7 @@ static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
 		return -EFAULT;
 
 	mutex_lock(&stream->device->lock);
-	if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED ||
-			stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
+	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
 		retval = -EBADFD;
 		goto out;
 	}
Signature · 1 line
1.7.2.5
#2 lore raw

At Tue, 12 Nov 2013 10:27:46 +0530,

Quoted 10 lines · Vinod Koul
Quoted 8 lines · Richard Fitzgerald

Pausing audio playback is not an illegal state so it doesn't seem sensible for poll() to return -EBADFD on a paused stream. There's also no reason to assume that we can't write more data to the DSP while playback is paused. Remove the -EBADFD so that a stream in paused state will still report the buffer availability from poll(). It is up to the user process to manage its state so that it knows whether it is paused or not.

Quoted 4 lines
Quoted 1 line

Acked-by VInod Koul <[email protected]>

Takashi, looks like I missed checking this earlier..

OK, applied now. Thanks.

Takashi

Quoted 27 lines

--
~Vinod

Quoted 21 lines
---
 sound/core/compress_offload.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
sound/core/compress_offload.c +1 -2
index bea523a..30ca133 100644
@@ -384,8 +384,7 @@ static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
 		return -EFAULT;
 
 	mutex_lock(&stream->device->lock);
-	if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED ||
-			stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
+	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
 		retval = -EBADFD;
 		goto out;
 	}
Signature · 1 line
1.7.2.5