mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
drm/msm: Unblock writer if reader closes file
Prevents deadlock when fifo is full and reader closes file. Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
f91168f485
commit
cd70d7ade4
1 changed files with 6 additions and 1 deletions
|
@ -115,7 +115,9 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz)
|
||||||
char *fptr = &fifo->buf[fifo->head];
|
char *fptr = &fifo->buf[fifo->head];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0);
|
wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open);
|
||||||
|
if (!rd->open)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Note that smp_load_acquire() is not strictly required
|
/* Note that smp_load_acquire() is not strictly required
|
||||||
* as CIRC_SPACE_TO_END() does not access the tail more
|
* as CIRC_SPACE_TO_END() does not access the tail more
|
||||||
|
@ -213,7 +215,10 @@ out:
|
||||||
static int rd_release(struct inode *inode, struct file *file)
|
static int rd_release(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct msm_rd_state *rd = inode->i_private;
|
struct msm_rd_state *rd = inode->i_private;
|
||||||
|
|
||||||
rd->open = false;
|
rd->open = false;
|
||||||
|
wake_up_all(&rd->fifo_event);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue