aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_fops.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-12-07 09:20:40 +1000
committerDave Airlie <airlied@redhat.com>2011-01-05 13:45:30 +1000
commit5bcf719b7db0f9366cedaf102b081f99b1c325ae (patch)
tree6929d42e1d61a3b1bd7b130a37a80b99718e14aa /drivers/gpu/drm/drm_fops.c
parent8d608aa6295242fe4c4b6105b8c59c6a5b232d89 (diff)
drm/switcheroo: track state of switch in drivers.
We need to track the state of the switch in drivers, so that after s/r we don't resume the card we've explicitly switched off before. Also don't allow a userspace open to occur if we've switched the gpu off. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r--drivers/gpu/drm/drm_fops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index a39794bac04b..2ec7d48fc4a8 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -236,6 +236,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
return -EBUSY; /* No exclusive opens */
if (!drm_cpu_valid())
return -EINVAL;
+ if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
+ return -EINVAL;
DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor_id);