diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-03-29 03:27:03 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-03-29 03:27:03 +0000 |
commit | a8e015d4201b83f7fa0892ac113809adda0babdd (patch) | |
tree | 408d799dd4fb02dd43aa0a0bc653875e1b1d3253 /sys/dev/pci | |
parent | 1d0b516be4ca5b356aaaa3cfafb9735c7f3a559f (diff) |
Remove the lock_time member from the hardware lock. It's not that
useful, and driver shouldn't need to know about ``ticks''.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_lock.c | 20 |
3 files changed, 8 insertions, 18 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 79871e8a014..a4eb253e0ca 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -270,11 +270,10 @@ struct drm_file { }; struct drm_lock_data { + struct mutex spinlock; struct drm_hw_lock *hw_lock; /* Hardware lock */ /* Unique identifier of holding process (NULL is kernel) */ struct drm_file *file_priv; - unsigned long lock_time; /* Time of last lock */ - struct mutex spinlock; }; /* This structure, in the struct drm_device, is always initialized while diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 093ccedbad5..9b075fe0cf3 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -467,7 +467,6 @@ drmclose(dev_t kdev, int flags, int fmt, struct proc *p) } if (drm_lock_take(&dev->lock, DRM_KERNEL_CONTEXT)) { dev->lock.file_priv = file_priv; - dev->lock.lock_time = jiffies; break; /* Got lock */ } /* Contention */ @@ -501,7 +500,7 @@ done: DRM_UNLOCK(); - return retcode; + return (retcode); } /* drmioctl is called whenever a process performs an ioctl on /dev/drm. diff --git a/sys/dev/pci/drm/drm_lock.c b/sys/dev/pci/drm/drm_lock.c index d5cff72b0e2..f7ffce5e526 100644 --- a/sys/dev/pci/drm/drm_lock.c +++ b/sys/dev/pci/drm/drm_lock.c @@ -63,20 +63,13 @@ drm_lock_take(struct drm_lock_data *lock_data, unsigned int context) new = context | _DRM_LOCK_HELD; } while (!atomic_cmpset_int(lock, old, new)); - if (_DRM_LOCKING_CONTEXT(old) == context) { - if (old & _DRM_LOCK_HELD) { - if (context != DRM_KERNEL_CONTEXT) { - DRM_ERROR("%d holds heavyweight lock\n", - context); - } - return 0; - } - } - if (new == (context | _DRM_LOCK_HELD)) { - /* Have lock */ - return 1; + if (_DRM_LOCKING_CONTEXT(old) == context && _DRM_LOCK_IS_HELD(old)) { + if (context != DRM_KERNEL_CONTEXT) + DRM_ERROR("%d holds heavyweight lock\n", context); + return (0); } - return 0; + /* If the lock wasn't held before, it's ours */ + return (!_DRM_LOCK_IS_HELD(old)); } int @@ -122,7 +115,6 @@ drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) for (;;) { if (drm_lock_take(&dev->lock, lock->context)) { dev->lock.file_priv = file_priv; - dev->lock.lock_time = jiffies; break; /* Got lock */ } |