All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies
Date: Wed, 29 Jan 2014 13:25:40 +0200	[thread overview]
Message-ID: <1390994741-9137-1-git-send-email-imre.deak@intel.com> (raw)

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(-)

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);
 	}
 }
 
-- 
1.8.4

             reply	other threads:[~2014-01-29 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29 11:25 Imre Deak [this message]
2014-01-29 11:25 ` [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic Imre Deak
2014-01-29 13:26   ` Chris Wilson
2014-01-29 19:47     ` Daniel Vetter
2014-01-29 13:26 ` [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390994741-9137-1-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.