diff options
author | Vinod Koul <vinod.koul@intel.com> | 2013-04-29 04:55:23 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-04-29 07:33:18 -0400 |
commit | 754813473c1a8b7711802313125f0fafc60141f8 (patch) | |
tree | 3d948cec2f7b73756c4cbb548546db57f0a17b22 /sound | |
parent | a555bb8c6bf6932c5706745bfdbad22df26324d9 (diff) |
ALSA: compress: fix the states to check for allowing read
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>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/compress_offload.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index a0bc47f8dcf7..99db892d7299 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -311,8 +311,16 @@ static ssize_t snd_compr_read(struct file *f, char __user *buf, | |||
311 | stream = &data->stream; | 311 | stream = &data->stream; |
312 | mutex_lock(&stream->device->lock); | 312 | mutex_lock(&stream->device->lock); |
313 | 313 | ||
314 | /* read is allowed when stream is running */ | 314 | /* read is allowed when stream is running, paused, draining and setup |
315 | if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) { | 315 | * (yes setup is state which we transition to after stop, so if user |
316 | * wants to read data after stop we allow that) | ||
317 | */ | ||
318 | switch (stream->runtime->state) { | ||
319 | case SNDRV_PCM_STATE_OPEN: | ||
320 | case SNDRV_PCM_STATE_PREPARED: | ||
321 | case SNDRV_PCM_STATE_XRUN: | ||
322 | case SNDRV_PCM_STATE_SUSPENDED: | ||
323 | case SNDRV_PCM_STATE_DISCONNECTED: | ||
316 | retval = -EBADFD; | 324 | retval = -EBADFD; |
317 | goto out; | 325 | goto out; |
318 | } | 326 | } |