ALSA: compress: allow writes in SNDRV_PCM_STATE_PREPARED state
authorEric Laurent <elaurent@google.com>
Wed, 2 Mar 2016 17:54:57 +0000 (09:54 -0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 4 Mar 2016 13:50:46 +0000 (14:50 +0100)
Allow writes in SNDRV_PCM_STATE_PREPARED state so that more
than one buffer fragment can be written from user space
before calling SNDRV_COMPRESS_START.

Signed-off-by: Eric Laurent <elaurent@google.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/compress_offload.c

index 7fac3cae8abd0a232a3d7a1c2563999495df6ec2..9e7c2f0831d7b7d2d859072282a7354a6d1f5404 100644 (file)
@@ -286,6 +286,7 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
        mutex_lock(&stream->device->lock);
        /* write is allowed when stream is running or has been steup */
        if (stream->runtime->state != SNDRV_PCM_STATE_SETUP &&
+           stream->runtime->state != SNDRV_PCM_STATE_PREPARED &&
                        stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
                mutex_unlock(&stream->device->lock);
                return -EBADFD;