All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: compress: fix the states to check for allowing read
@ 2013-04-28  8:05 Vinod Koul
  2013-04-29  8:55 ` Takashi Iwai
  2013-04-29 11:07 ` Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Vinod Koul @ 2013-04-28  8:05 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, Vinod Koul, broonie, liam.r.girdwood, Charles Keepax,
	Richard Fitzgerald

for reading compressed data, we need to allow when we are paused, draining or
stopped.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

---
 sound/core/compress_offload.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index a0bc47f..5389b9a 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -311,8 +311,14 @@ static ssize_t snd_compr_read(struct file *f, char __user *buf,
 	stream = &data->stream;
 	mutex_lock(&stream->device->lock);
 
-	/* read is allowed when stream is running */
-	if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
+	/* read is allowed when stream is running, paused, draining and setup
+	 * (yes setup is state which we transistion to after stop, so if user
+	 * wants to read data after stop we allow that
+	 */
+	if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING ||
+			stream->runtime->state != SNDRV_PCM_STATE_DRAINING ||
+			stream->runtime->state != SNDRV_PCM_STATE_PAUSED ||
+			stream->runtime->state != SNDRV_PCM_STATE_SETUP) {
 		retval = -EBADFD;
 		goto out;
 	}
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-04-29 11:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-28  8:05 [PATCH] ALSA: compress: fix the states to check for allowing read Vinod Koul
2013-04-29  8:55 ` Takashi Iwai
2013-04-29  8:45   ` Vinod Koul
2013-04-29  9:20     ` Takashi Iwai
2013-04-29  8:57       ` Vinod Koul
2013-04-29  9:29       ` Richard Fitzgerald
2013-04-29  9:00         ` Vinod Koul
2013-04-29 11:07 ` Mark Brown
2013-04-29 10:54   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.