diff options
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/atom.c | 2 | ||||
-rw-r--r-- | include/drm/drmP.h | 8 |
3 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5ac8a164a1ee..1348705faf6b 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -40,7 +40,7 @@ | |||
40 | ret__ = -ETIMEDOUT; \ | 40 | ret__ = -ETIMEDOUT; \ |
41 | break; \ | 41 | break; \ |
42 | } \ | 42 | } \ |
43 | if (W && !(in_atomic() || in_dbg_master())) msleep(W); \ | 43 | if (W && drm_can_sleep()) msleep(W); \ |
44 | } \ | 44 | } \ |
45 | ret__; \ | 45 | ret__; \ |
46 | }) | 46 | }) |
@@ -48,13 +48,6 @@ | |||
48 | #define wait_for(COND, MS) _wait_for(COND, MS, 1) | 48 | #define wait_for(COND, MS) _wait_for(COND, MS, 1) |
49 | #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0) | 49 | #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0) |
50 | 50 | ||
51 | #define MSLEEP(x) do { \ | ||
52 | if (in_dbg_master()) \ | ||
53 | mdelay(x); \ | ||
54 | else \ | ||
55 | msleep(x); \ | ||
56 | } while (0) | ||
57 | |||
58 | #define KHz(x) (1000*x) | 51 | #define KHz(x) (1000*x) |
59 | #define MHz(x) KHz(1000*x) | 52 | #define MHz(x) KHz(1000*x) |
60 | 53 | ||
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 14cc88aaf3a7..d1bd239cd9e9 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -665,6 +665,8 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) | |||
665 | SDEBUG(" count: %d\n", count); | 665 | SDEBUG(" count: %d\n", count); |
666 | if (arg == ATOM_UNIT_MICROSEC) | 666 | if (arg == ATOM_UNIT_MICROSEC) |
667 | udelay(count); | 667 | udelay(count); |
668 | else if (!drm_can_sleep()) | ||
669 | mdelay(count); | ||
668 | else | 670 | else |
669 | msleep(count); | 671 | msleep(count); |
670 | } | 672 | } |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index ecd5984ef689..954badb08120 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1696,5 +1696,13 @@ extern void drm_platform_exit(struct drm_driver *driver, struct platform_device | |||
1696 | extern int drm_get_platform_dev(struct platform_device *pdev, | 1696 | extern int drm_get_platform_dev(struct platform_device *pdev, |
1697 | struct drm_driver *driver); | 1697 | struct drm_driver *driver); |
1698 | 1698 | ||
1699 | /* returns true if currently okay to sleep */ | ||
1700 | static __inline__ bool drm_can_sleep(void) | ||
1701 | { | ||
1702 | if (in_atomic() || in_dbg_master() || irqs_disabled()) | ||
1703 | return false; | ||
1704 | return true; | ||
1705 | } | ||
1706 | |||
1699 | #endif /* __KERNEL__ */ | 1707 | #endif /* __KERNEL__ */ |
1700 | #endif | 1708 | #endif |