Skip to content

Commit

Permalink
drm/i915: fold wait_for_atomic_us into wait_for_atomic
Browse files Browse the repository at this point in the history
Since

commit bcf9dcc
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jul 15 09:42:38 2012 +0100

    drm/i915: Workaround hang with BSD and forcewake on SandyBridge

and

commit 0cc2764
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Sat Sep 1 22:59:48 2012 -0700

    drm/i915: use cpu_relax() in wait_for_atomic

these two macros are essentially the same, so unify them. We keep the
_us version since it's a nice documentation for smaller timeouts.

v2: Fixup time unit conversion, _wait_for takes ms (Ville).

Cc: Jack Winter <jbh@alchemy.lu>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Daniel Vetter committed Mar 28, 2013
1 parent 0ff9800 commit 6effa33
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions drivers/gpu/drm/i915/intel_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,10 @@
ret__; \
})

#define wait_for_atomic_us(COND, US) ({ \
unsigned long timeout__ = jiffies + usecs_to_jiffies(US); \
int ret__ = 0; \
while (!(COND)) { \
if (time_after(jiffies, timeout__)) { \
ret__ = -ETIMEDOUT; \
break; \
} \
cpu_relax(); \
} \
ret__; \
})

#define wait_for(COND, MS) _wait_for(COND, MS, 1)
#define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0)
#define wait_for_atomic_us(COND, US) _wait_for((COND), \
DIV_ROUND_UP((US), 1000), 0)

#define KHz(x) (1000*x)
#define MHz(x) KHz(1000*x)
Expand Down

0 comments on commit 6effa33

Please sign in to comment.