{
struct dma_fence *fence;
long wait_err;
+ u32 curr;
- host1x_hw_syncpt_load(sp->host, sp);
+ curr = host1x_syncpt_load(sp);
if (value)
- *value = host1x_syncpt_load(sp);
+ *value = curr;
if (host1x_syncpt_is_expired(sp, thresh))
return 0;
host1x_fence_cancel(fence);
dma_fence_put(fence);
- if (value)
- *value = host1x_syncpt_load(sp);
-
/*
* Don't rely on dma_fence_wait_timeout return value,
* since it returns zero both on timeout and if the
* wait completed with 0 jiffies left.
*/
- host1x_hw_syncpt_load(sp->host, sp);
- if (wait_err == 0 && !host1x_syncpt_is_expired(sp, thresh))
+ if (wait_err == 0 && !host1x_syncpt_is_expired(sp, thresh)) {
+ if (value)
+ *value = host1x_syncpt_load(sp);
+
return -EAGAIN;
- else if (wait_err < 0)
+ } else if (wait_err < 0) {
return wait_err;
- else
+ } else {
+ /* Success, read the value cached by ISR */
+ if (value)
+ *value = host1x_syncpt_read_min(sp);
+
return 0;
+ }
}
EXPORT_SYMBOL(host1x_syncpt_wait);