aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_drv.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-02-20 09:18:07 -0500
committerDave Airlie <airlied@redhat.com>2012-03-15 09:35:33 -0400
commit2c07a21d6fb0be47fda696a618b726ea258ed1dd (patch)
tree8ab0b7541ee4f9f75397d3da190426041dc08c6e /drivers/gpu/drm/drm_drv.c
parentcbc7e22151d99ed1dd7649d268ad3d81b9e6255a (diff)
drm: add core support for unplugging a device (v2)
Two parts to this, one is simple unplug from sysfs for the device node. The second adds an unplugged state, if we have device opens, we just set the unplugged state and return, if we have no device opens we drop the drm device. If after a lastclose we discover we are unplugged we then drop the drm device. v2: use an atomic for unplugged and wrap it for users, add checks on open + mmap + ioctl entry points. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r--drivers/gpu/drm/drm_drv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index d166bd080400..0b65fbc8a630 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -390,6 +390,10 @@ long drm_ioctl(struct file *filp,
390 unsigned int usize, asize; 390 unsigned int usize, asize;
391 391
392 dev = file_priv->minor->dev; 392 dev = file_priv->minor->dev;
393
394 if (drm_device_is_unplugged(dev))
395 return -ENODEV;
396
393 atomic_inc(&dev->ioctl_count); 397 atomic_inc(&dev->ioctl_count);
394 atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); 398 atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
395 ++file_priv->ioctl_count; 399 ++file_priv->ioctl_count;