diff options
author | Dave Airlie <airlied@redhat.com> | 2012-02-20 09:18:07 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-03-15 09:35:33 -0400 |
commit | 2c07a21d6fb0be47fda696a618b726ea258ed1dd (patch) | |
tree | 8ab0b7541ee4f9f75397d3da190426041dc08c6e /drivers/gpu/drm/drm_gem.c | |
parent | cbc7e22151d99ed1dd7649d268ad3d81b9e6255a (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_gem.c')
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 3ebe3c8f58b5..0ef358e53245 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -661,6 +661,9 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) | |||
661 | struct drm_hash_item *hash; | 661 | struct drm_hash_item *hash; |
662 | int ret = 0; | 662 | int ret = 0; |
663 | 663 | ||
664 | if (drm_device_is_unplugged(dev)) | ||
665 | return -ENODEV; | ||
666 | |||
664 | mutex_lock(&dev->struct_mutex); | 667 | mutex_lock(&dev->struct_mutex); |
665 | 668 | ||
666 | if (drm_ht_find_item(&mm->offset_hash, vma->vm_pgoff, &hash)) { | 669 | if (drm_ht_find_item(&mm->offset_hash, vma->vm_pgoff, &hash)) { |