Skip to content

Commit

Permalink
nvidia/drivers: dc: fix return code in tegra_dc_wait_for_vsync
Browse files Browse the repository at this point in the history
The return code from wait_for_completion_interruptible_timeout()
was being returned directly as an error code (to userspace through
the FBIO_WAITFORVSYNC ioctl), instead of being translated, so
change the logic:

 * loop while the return code is -ERESTARTSYS due to interruption
 * 0 return is timeout, so return -ETIME
 * > 0 is success

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: CTCaer <ctcaer@gmail.com>
  • Loading branch information
CTCaer committed Mar 16, 2021
1 parent cbfd7a9 commit b1e9afc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/video/tegra/dc/dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4493,14 +4493,18 @@ int tegra_dc_wait_for_vsync(struct tegra_dc *dc)
timeout_ms = DIV_ROUND_UP(2 * 1000000, refresh);
_tegra_dc_user_vsync_enable(dc, true);
mutex_unlock(&dc->lock);
ret = wait_for_completion_interruptible_timeout(
&dc->out->user_vblank_comp, msecs_to_jiffies(timeout_ms));
do {
ret = wait_for_completion_interruptible_timeout(
&dc->out->user_vblank_comp, msecs_to_jiffies(timeout_ms));
} while (ret == -ERESTARTSYS);
mutex_lock(&dc->lock);
if (ret == 0)
ret = -ETIMEDOUT;
_tegra_dc_user_vsync_enable(dc, false);
out:
mutex_unlock(&dc->lock);
mutex_unlock(&dc->lp_lock);
return ret;
return (ret >= 0 ? 0 : ret);
}

int _tegra_dc_wait_for_frame_end(struct tegra_dc *dc,
Expand Down

0 comments on commit b1e9afc

Please sign in to comment.