diff options
author | 2009-03-29 03:27:02 +0000 | |
---|---|---|
committer | 2009-03-29 03:27:02 +0000 | |
commit | 82beb5ca254b58acd8f2e4b57f51ab52869e067b (patch) | |
tree | ccbd4cfffaf1adb7e0c03722e97b29cf2b57ff5e | |
parent | when we steal the SYNC CACHE command in mfi_scsi_cmd we still have to (diff) | |
download | wireguard-openbsd-82beb5ca254b58acd8f2e4b57f51ab52869e067b.tar.xz wireguard-openbsd-82beb5ca254b58acd8f2e4b57f51ab52869e067b.zip |
Remove the lock_time member from the hardware lock. It's not that
useful, and driver shouldn't need to know about ``ticks''.
-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 */ } |