Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363278
b: refs/heads/master
c: c679212
h: refs/heads/master
v: v3
  • Loading branch information
Erik Gilling authored and Greg Kroah-Hartman committed Mar 4, 2013
1 parent 13cf1ec commit 5024ff4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7560645406b8341ab74644b505297e3e32fa6f3a
refs/heads/master: c679212dbfd060513e156133326122bf9f496579
18 changes: 17 additions & 1 deletion trunk/drivers/staging/android/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,24 @@ int sync_fence_cancel_async(struct sync_fence *fence,
}
EXPORT_SYMBOL(sync_fence_cancel_async);

static bool sync_fence_check(struct sync_fence *fence)
{
/*
* Make sure that reads to fence->status are ordered with the
* wait queue event triggering
*/
smp_rmb();
return fence->status != 0;
}

int sync_fence_wait(struct sync_fence *fence, long timeout)
{
int err = 0;

if (timeout > 0) {
timeout = msecs_to_jiffies(timeout);
err = wait_event_interruptible_timeout(fence->wq,
fence->status != 0,
sync_fence_check(fence),
timeout);
} else if (timeout < 0) {
err = wait_event_interruptible(fence->wq, fence->status != 0);
Expand Down Expand Up @@ -630,6 +640,12 @@ static unsigned int sync_fence_poll(struct file *file, poll_table *wait)

poll_wait(file, &fence->wq, wait);

/*
* Make sure that reads to fence->status are ordered with the
* wait queue event triggering
*/
smp_rmb();

if (fence->status == 1)
return POLLIN;
else if (fence->status < 0)
Expand Down

0 comments on commit 5024ff4

Please sign in to comment.