From 9996c9d0d210ae75b223a38e430a7cfa916da858 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 30 Aug 2010 12:41:23 -0700 Subject: [PATCH] video: tegra: fix syncpoint timeouts in host1x driver Change-Id: Ief81ad3ce74cc446e21e54c2d2acca977f0fa934 Signed-off-by: Erik Gilling --- drivers/video/tegra/host/nvhost_syncpt.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c index 4a51fcf792b3..dd2ab0d379e0 100644 --- a/drivers/video/tegra/host/nvhost_syncpt.c +++ b/drivers/video/tegra/host/nvhost_syncpt.c @@ -194,16 +194,23 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id, if (err) goto done; + err = -EAGAIN; /* wait for the syncpoint, or timeout, or signal */ while (timeout) { u32 check = min_t(u32, SYNCPT_CHECK_PERIOD, timeout); - err = wait_event_interruptible_timeout(wq, + int remain = wait_event_interruptible_timeout(wq, nvhost_syncpt_min_cmp(sp, id, thresh), check); - if (err != 0) + if (remain > 0 || nvhost_syncpt_min_cmp(sp, id, thresh)) { + err = 0; break; + } + if (remain < 0) { + err = remain; + break; + } if (timeout != NVHOST_NO_TIMEOUT) - timeout -= SYNCPT_CHECK_PERIOD; + timeout -= check; if (timeout) { dev_warn(&syncpt_to_dev(sp)->pdev->dev, "syncpoint id %d (%s) stuck waiting %d\n", @@ -211,10 +218,6 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id, nvhost_syncpt_debug(sp); } }; - if (err > 0) - err = 0; - else if (err == 0) - err = -EAGAIN; nvhost_intr_put_ref(&(syncpt_to_dev(sp)->intr), ref); done: -- 2.34.1