Skip to content

Commit

Permalink
staging: xlnxsync: Fix l_done and c_done in the poll()
Browse files Browse the repository at this point in the history
Application is continuously receiving framedone in poll().

Fix this by breaking from loop on error or frame done event becoming
true.

Signed-off-by: Vishal Sagar <[email protected]>
Tested-by: Dylan Yip <[email protected]>
  • Loading branch information
vishals-xlnx authored and Michal Simek committed Sep 10, 2019
1 parent 30a43e5 commit e3e35bc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions drivers/staging/xlnxsync/xlnxsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ static long xlnxsync_ioctl(struct file *fptr, unsigned int cmd,

static __poll_t xlnxsync_poll(struct file *fptr, poll_table *wait)
{
u32 i, j;
u32 i, j, k;
bool err_event, framedone_event;
__poll_t ret = 0;
unsigned long flags;
Expand All @@ -658,15 +658,22 @@ static __poll_t xlnxsync_poll(struct file *fptr, poll_table *wait)
err_event = false;
for (i = 0; i < dev->config.max_channels && !err_event; i++) {
if (dev->sync_err[i] || dev->wdg_err[i] ||
dev->ldiff_err[i] || dev->cdiff_err[i])
dev->ldiff_err[i] || dev->cdiff_err[i]) {
err_event = true;
break;
}
}

framedone_event = false;
for (i = 0; i < dev->config.max_channels && !framedone_event; i++) {
for (j = 0; j < XLNXSYNC_BUF_PER_CHAN; j++) {
if (dev->l_done[i][j] && dev->c_done[i][j])
framedone_event = true;
for (k = 0; k < XLNXSYNC_IO; k++) {
if (dev->l_done[i][j][k] &&
dev->c_done[i][j][k]) {
framedone_event = true;
break;
}
}
}
}
spin_unlock_irqrestore(&dev->irq_lock, flags);
Expand Down

0 comments on commit e3e35bc

Please sign in to comment.