diff mbox

[v2,1/2] drm/i915: fix wait_remaining_ms_from_jiffies

Message ID 1390994741-9137-1-git-send-email-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Imre Deak Jan. 29, 2014, 11:25 a.m. UTC
schedule_timeout_uninterruptible() takes jiffies not ms.

v2:
- ignore the overflow issue, the practical part of that should
  be solved instead in the caller (Chris)

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Chris Wilson Jan. 29, 2014, 1:26 p.m. UTC | #1
On Wed, Jan 29, 2014 at 01:25:40PM +0200, Imre Deak wrote:
> schedule_timeout_uninterruptible() takes jiffies not ms.
> 
> v2:
> - ignore the overflow issue, the practical part of that should
>   be solved instead in the caller (Chris)
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3673ba1..8f396b9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2647,8 +2647,7 @@  timespec_to_jiffies_timeout(const struct timespec *value)
 static inline void
 wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 {
-	unsigned long target_jiffies, tmp_jiffies;
-	unsigned int remaining_ms;
+	unsigned long target_jiffies, tmp_jiffies, remaining_jiffies;
 
 	/*
 	 * Don't re-read the value of "jiffies" every time since it may change
@@ -2659,11 +2658,10 @@  wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 			 msecs_to_jiffies_timeout(to_wait_ms);
 
 	if (time_after(target_jiffies, tmp_jiffies)) {
-		remaining_ms = jiffies_to_msecs((long)target_jiffies -
-						(long)tmp_jiffies);
-		while (remaining_ms)
-			remaining_ms =
-				schedule_timeout_uninterruptible(remaining_ms);
+		remaining_jiffies = target_jiffies - tmp_jiffies;
+		while (remaining_jiffies)
+			remaining_jiffies =
+			    schedule_timeout_uninterruptible(remaining_jiffies);
 	}
 }