Commit 972e3b99 authored by 薛德章's avatar 薛德章 Committed by Ugo Riboni

Fix OSS driver doesn't respect O_NONBLOCK when recording

This patch added a variable to mark if data available or not.
Fixed bug 4740.
Signed-off-by: default avatar薛德章 <frank.xue@neuros.com.cn>
parent c3c8d971
...@@ -973,6 +973,7 @@ static void audio_dma_callback(int lch, u16 ch_status, void *data) ...@@ -973,6 +973,7 @@ static void audio_dma_callback(int lch, u16 ch_status, void *data)
if (!s->mapped) { if (!s->mapped) {
complete(&s->wfc); complete(&s->wfc);
s->done_flag = 1;
} else } else
s->pending_frags++; s->pending_frags++;
......
...@@ -615,7 +615,7 @@ audio_read(struct file *file, char *buffer, size_t count, loff_t * ppos) ...@@ -615,7 +615,7 @@ audio_read(struct file *file, char *buffer, size_t count, loff_t * ppos)
/* Wait for a buffer to become full */ /* Wait for a buffer to become full */
if (file->f_flags & O_NONBLOCK) { if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN; ret = -EAGAIN;
if (!s->wfc.done) if(!s->done_flag)
break; break;
} else { } else {
ret = -ERESTARTSYS; ret = -ERESTARTSYS;
...@@ -652,6 +652,7 @@ audio_read(struct file *file, char *buffer, size_t count, loff_t * ppos) ...@@ -652,6 +652,7 @@ audio_read(struct file *file, char *buffer, size_t count, loff_t * ppos)
DPRINTK(KERN_INFO DPRINTK(KERN_INFO
"calling audio_process_dma from audio_read\n"); "calling audio_process_dma from audio_read\n");
audio_process_dma(s); audio_process_dma(s);
s->done_flag = 0;
} }
if ((buffer - buffer0)) if ((buffer - buffer0))
...@@ -1105,6 +1106,7 @@ static int audio_open(struct inode *inode, struct file *file) ...@@ -1105,6 +1106,7 @@ static int audio_open(struct inode *inode, struct file *file)
is->fragsize = AUDIO_FRAGSIZE_DEFAULT; is->fragsize = AUDIO_FRAGSIZE_DEFAULT;
is->nbfrags = AUDIO_NBFRAGS_DEFAULT; is->nbfrags = AUDIO_NBFRAGS_DEFAULT;
is->mapped = 0; is->mapped = 0;
is->done_flag = 0;
init_waitqueue_head(&is->wq); init_waitqueue_head(&is->wq);
} }
......
...@@ -69,6 +69,7 @@ typedef struct { ...@@ -69,6 +69,7 @@ typedef struct {
int stopped:1; /* might be active but stopped */ int stopped:1; /* might be active but stopped */
int spin_idle:1; /* have DMA spin on zeros when idle */ int spin_idle:1; /* have DMA spin on zeros when idle */
int dma_started; /* to store if DMA was started or not */ int dma_started; /* to store if DMA was started or not */
int done_flag;
} audio_stream_t; } audio_stream_t;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment