drm/i915: fix up _wait_for macro
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 27 Mar 2013 23:03:25 +0000 (00:03 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 28 Mar 2013 15:41:13 +0000 (16:41 +0100)
commit1d5bfac96f1e1856fbdb3f06679691e5b9c2ba8f
treee0ab711e8c18a05f5e08021e708ff287e20247b0
parent6effa33b73fb0129061ecd8ba3158d984475d35d
drm/i915: fix up _wait_for macro

As Thomas Gleixner spotted, it's rather horrible racy:
- We can miss almost a full tick, so need to compensate by 1 jiffy.
- We need to re-check the condition when having timed-out, since a
  the last check could have been before the timeout expired. E.g. when
  we've been preempted or a long irq happened.

Cc: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Jack Winter <jbh@alchemy.lu>
Cc: Jack Winter <jbh@alchemy.lu>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_drv.h