summaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-01-05 10:55:22 +0100
committerDave Airlie <airlied@redhat.com>2012-01-06 11:01:35 +0100
commitcc1f71942944890c7e05fc55dc4427c94b63d4f1 (patch)
tree2e9e1b347adb6e4457a02da6e5c2fcbdda851a28 /include/drm
parentradeon: Fix disabling PCI bus mastering on big endian hosts. (diff)
downloadlinux-cc1f71942944890c7e05fc55dc4427c94b63d4f1.tar.xz
linux-cc1f71942944890c7e05fc55dc4427c94b63d4f1.zip
drm: introduce drm_can_sleep and use in intel/radeon drivers. (v2)
So we have a few places where the drm drivers would like to sleep to be nice to the system, mainly in the modesetting paths, but we also have two cases were atomic modesetting must take place, panic writing and kernel debugger. So provide a central inline to determine if a sleep or delay should be used and use this in the intel and radeon drivers. v2: drop intel_drv.h MSLEEP macro, nobody uses it. Based on patch from Michel Dänzer <michel.daenzer@amd.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941 Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h8
1 files changed, 8 insertions, 0 deletions
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
extern int drm_get_platform_dev(struct platform_device *pdev,
struct drm_driver *driver);
+/* returns true if currently okay to sleep */
+static __inline__ bool drm_can_sleep(void)
+{
+ if (in_atomic() || in_dbg_master() || irqs_disabled())
+ return false;
+ return true;
+}
+
#endif /* __KERNEL__ */
#endif