summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/drm_lock.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-11-04 16:19:55 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-11-04 16:19:55 +0000
commit548c734a64a085622f716cfaf3f198e84aadb959 (patch)
tree735b65af30a05f8d1c4fa08b0163307fa06fc05a /sys/dev/pci/drm/drm_lock.c
parent1d806ad294819a04b7a40cc97a346bc0d95b8bf3 (diff)
If we need to call the tasklet function on unlock, we don't need to hold
tsk_lock (which blocks irqs) for the whole call of the function, just when we manipulate the function pointer.
Diffstat (limited to 'sys/dev/pci/drm/drm_lock.c')
-rw-r--r--sys/dev/pci/drm/drm_lock.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/drm_lock.c b/sys/dev/pci/drm/drm_lock.c
index de4fa1dd38c..17552372f37 100644
--- a/sys/dev/pci/drm/drm_lock.c
+++ b/sys/dev/pci/drm/drm_lock.c
@@ -154,6 +154,7 @@ int
drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
struct drm_lock *lock = data;
+ void (*func)(struct drm_device *);
if (lock->context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n",
@@ -167,12 +168,12 @@ drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) != lock->context)
return EINVAL;
- DRM_SPINLOCK(&dev->tsk_lock);
- if (dev->locked_task_call != NULL) {
- dev->locked_task_call(dev);
- dev->locked_task_call = NULL;
- }
- DRM_SPINUNLOCK(&dev->tsk_lock);
+ mtx_enter(&dev->tsk_lock);
+ func = dev->locked_task_call;
+ dev->locked_task_call = NULL;
+ mtx_leave(&dev->tsk_lock);
+ if (func != NULL)
+ (*func)(dev);
if (drm_lock_free(&dev->lock, lock->context)) {
DRM_ERROR("\n");