aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fops.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-05 19:02:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-05 19:02:01 -0400
commitfc1caf6eafb30ea185720e29f7f5eccca61ecd60 (patch)
tree666dabc25a9b02e5c05f9eba32fa6b0d8027341a /drivers/gpu/drm/drm_fops.c
parent9779714c8af09d57527f18d9aa2207dcc27a8687 (diff)
parent96576a9e1a0cdb8a43d3af5846be0948f52b4460 (diff)
Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (204 commits) agp: intel-agp: do not use PCI resources before pci_enable_device() agp: efficeon-agp: do not use PCI resources before pci_enable_device() drm: kill BKL from common code drm/kms: Simplify setup of the initial I2C encoder config. drm,io-mapping: Specify slot to use for atomic mappings drm/radeon/kms: only expose underscan on avivo chips drm/radeon: add new pci ids drm: Cleanup after failing to create master->unique and dev->name drm/radeon: tone down overchatty acpi debug messages. drm/radeon/kms: enable underscan option for digital connectors drm/radeon/kms: fix calculation of h/v scaling factors drm/radeon/kms/igp: sideport is AMD only drm/radeon/kms: handle the case of no active displays properly in the bandwidth code drm: move ttm global code to core drm drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it. drm/radeon/kms: make sure HPD is set to NONE on analog-only connectors drm/radeon/kms: make sure rio_mem is valid before unmapping it drm/agp/i915: trim stolen space to 32M drm/i915: Unset cursor if out-of-bounds upon mode change (v4) drm/i915: Unreference object not handle on creation ...
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r--drivers/gpu/drm/drm_fops.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index e7aace20981f..2ca8df8b6102 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -39,6 +39,9 @@
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/smp_lock.h> 40#include <linux/smp_lock.h>
41 41
42/* from BKL pushdown: note that nothing else serializes idr_find() */
43DEFINE_MUTEX(drm_global_mutex);
44
42static int drm_open_helper(struct inode *inode, struct file *filp, 45static int drm_open_helper(struct inode *inode, struct file *filp,
43 struct drm_device * dev); 46 struct drm_device * dev);
44 47
@@ -175,8 +178,7 @@ int drm_stub_open(struct inode *inode, struct file *filp)
175 178
176 DRM_DEBUG("\n"); 179 DRM_DEBUG("\n");
177 180
178 /* BKL pushdown: note that nothing else serializes idr_find() */ 181 mutex_lock(&drm_global_mutex);
179 lock_kernel();
180 minor = idr_find(&drm_minors_idr, minor_id); 182 minor = idr_find(&drm_minors_idr, minor_id);
181 if (!minor) 183 if (!minor)
182 goto out; 184 goto out;
@@ -197,7 +199,7 @@ int drm_stub_open(struct inode *inode, struct file *filp)
197 fops_put(old_fops); 199 fops_put(old_fops);
198 200
199out: 201out:
200 unlock_kernel(); 202 mutex_unlock(&drm_global_mutex);
201 return err; 203 return err;
202} 204}
203 205
@@ -472,7 +474,7 @@ int drm_release(struct inode *inode, struct file *filp)
472 struct drm_device *dev = file_priv->minor->dev; 474 struct drm_device *dev = file_priv->minor->dev;
473 int retcode = 0; 475 int retcode = 0;
474 476
475 lock_kernel(); 477 mutex_lock(&drm_global_mutex);
476 478
477 DRM_DEBUG("open_count = %d\n", dev->open_count); 479 DRM_DEBUG("open_count = %d\n", dev->open_count);
478 480
@@ -573,17 +575,14 @@ int drm_release(struct inode *inode, struct file *filp)
573 if (atomic_read(&dev->ioctl_count)) { 575 if (atomic_read(&dev->ioctl_count)) {
574 DRM_ERROR("Device busy: %d\n", 576 DRM_ERROR("Device busy: %d\n",
575 atomic_read(&dev->ioctl_count)); 577 atomic_read(&dev->ioctl_count));
576 spin_unlock(&dev->count_lock); 578 retcode = -EBUSY;
577 unlock_kernel(); 579 goto out;
578 return -EBUSY;
579 } 580 }
580 spin_unlock(&dev->count_lock); 581 retcode = drm_lastclose(dev);
581 unlock_kernel();
582 return drm_lastclose(dev);
583 } 582 }
583out:
584 spin_unlock(&dev->count_lock); 584 spin_unlock(&dev->count_lock);
585 585 mutex_unlock(&drm_global_mutex);
586 unlock_kernel();
587 586
588 return retcode; 587 return retcode;
589} 588}