summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_drv.h
diff options
context:
space:
mode:
authorChris Wilson2017-11-14 22:56:55 +0100
committerChris Wilson2017-11-17 11:38:04 +0100
commit290b20a6d34acc188aec01669c210d731cc0ec15 (patch)
tree0ab4448f88d34bd3ecac4451fcdf0ad2b595acf7 /drivers/gpu/drm/i915/intel_drv.h
parentdrm/i915/selftests: Add a GuC doorbells selftest (diff)
downloadkernel-qcow2-linux-290b20a6d34acc188aec01669c210d731cc0ec15.tar.gz
kernel-qcow2-linux-290b20a6d34acc188aec01669c210d731cc0ec15.tar.xz
kernel-qcow2-linux-290b20a6d34acc188aec01669c210d731cc0ec15.zip
drm/i915: Add might_sleep() check to wait_for()
We should long past the time of trying to use wait_for() from inside atomic contexts, so add a might_sleep() check to prevent misuse. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171114215655.4849-1-chris@chris-wilson.co.uk Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_drv.h')
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e9b66e0cb647..645c5e8ee9f0 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -47,14 +47,11 @@
* contexts. Note that it's important that we check the condition again after
* having timed out, since the timeout could be due to preemption or similar and
* we've never had a chance to check the condition before the timeout.
- *
- * TODO: When modesetting has fully transitioned to atomic, the below
- * drm_can_sleep() can be removed and in_atomic()/!in_atomic() asserts
- * added.
*/
#define _wait_for(COND, US, W) ({ \
unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \
int ret__; \
+ might_sleep(); \
for (;;) { \
bool expired__ = time_after(jiffies, timeout__); \
if (COND) { \
@@ -65,11 +62,7 @@
ret__ = -ETIMEDOUT; \
break; \
} \
- if ((W) && drm_can_sleep()) { \
- usleep_range((W), (W)*2); \
- } else { \
- cpu_relax(); \
- } \
+ usleep_range((W), (W) * 2); \
} \
ret__; \
})