[Intel-gfx] [PATCH] drm/i915: Fix pipe off timeout handling for pre-gen4

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Thu Oct 10 19:32:23 CEST 2013

From: Ville Syrjälä <ville.syrjala at linux.intel.com>

The current pre-gen4 pipe off code might break out of the loop
due to the timeout, but then the fail to print the warning.

Fix the issue by making sure we pair up the correct time comparison
functions. It would be enough to change just the final check to use
time_after_eq(), but also changing the loop condition to use
time_before() instead of time_after() makes the whole thing look a
bit saner since then we always compare jiffies and timeout in the same
order, and the words before and after now feel more natural when
talking about the timeout.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 27f98bc..07cd8f8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -845,8 +845,8 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)
 			last_line = I915_READ(reg) & line_mask;
 		} while (((I915_READ(reg) & line_mask) != last_line) &&
-			 time_after(timeout, jiffies));
-		if (time_after(jiffies, timeout))
+			 time_before(jiffies, timeout));
+		if (time_after_eq(jiffies, timeout))
 			WARN(1, "pipe_off wait timed out\n");

More information about the Intel-gfx mailing list