Fix returned timeout in wait_seqno: remaining time, not time slept.

This commit is contained in:
riastradh 2015-02-26 14:10:14 +00:00
parent a82af3b335
commit b3c8e40fbd

View File

@ -1441,8 +1441,22 @@ __wait_seqno(struct intel_ring_buffer *ring, u32 seqno, unsigned reset_counter,
if (!irq_test_in_progress)
ring->irq_put(ring);
if (timeout)
timespecsub(&after, &before, timeout);
if (timeout) {
struct timespec slept;
/* Compute slept = after - before. */
timespecsub(&after, &before, &slept);
/*
* Return the time remaining, timeout - slept, if we
* slept for less time than the timeout; or zero if we
* timed out.
*/
if (timespeccmp(&slept, timeout, <))
timespecsub(timeout, &slept, timeout);
else
timespecclear(timeout);
}
return MAX(ret, 0); /* ignore remaining ticks */
}
#else