Lines Matching refs:lock
63 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_lock_take() local
67 old = *lock; in drm_lock_take()
75 prev = cmpxchg(lock, old, new); in drm_lock_take()
112 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_lock_transfer() local
116 old = *lock; in drm_lock_transfer()
118 prev = cmpxchg(lock, old, new); in drm_lock_transfer()
127 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_legacy_lock_free() local
139 old = *lock; in drm_legacy_lock_free()
141 prev = cmpxchg(lock, old, new); in drm_legacy_lock_free()
168 struct drm_lock *lock = data; in drm_legacy_lock() local
177 if (lock->context == DRM_KERNEL_CONTEXT) { in drm_legacy_lock()
179 task_pid_nr(current), lock->context); in drm_legacy_lock()
184 lock->context, task_pid_nr(current), in drm_legacy_lock()
185 master->lock.hw_lock ? master->lock.hw_lock->lock : -1, in drm_legacy_lock()
186 lock->flags); in drm_legacy_lock()
188 add_wait_queue(&master->lock.lock_queue, &entry); in drm_legacy_lock()
189 spin_lock_bh(&master->lock.spinlock); in drm_legacy_lock()
190 master->lock.user_waiters++; in drm_legacy_lock()
191 spin_unlock_bh(&master->lock.spinlock); in drm_legacy_lock()
195 if (!master->lock.hw_lock) { in drm_legacy_lock()
201 if (drm_lock_take(&master->lock, lock->context)) { in drm_legacy_lock()
202 master->lock.file_priv = file_priv; in drm_legacy_lock()
203 master->lock.lock_time = jiffies; in drm_legacy_lock()
216 spin_lock_bh(&master->lock.spinlock); in drm_legacy_lock()
217 master->lock.user_waiters--; in drm_legacy_lock()
218 spin_unlock_bh(&master->lock.spinlock); in drm_legacy_lock()
220 remove_wait_queue(&master->lock.lock_queue, &entry); in drm_legacy_lock()
222 DRM_DEBUG("%d %s\n", lock->context, in drm_legacy_lock()
230 dev->sigdata.context = lock->context; in drm_legacy_lock()
231 dev->sigdata.lock = master->lock.hw_lock; in drm_legacy_lock()
234 if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT)) in drm_legacy_lock()
238 lock->context); in drm_legacy_lock()
259 struct drm_lock *lock = data; in drm_legacy_unlock() local
265 if (lock->context == DRM_KERNEL_CONTEXT) { in drm_legacy_unlock()
267 task_pid_nr(current), lock->context); in drm_legacy_unlock()
271 if (drm_legacy_lock_free(&master->lock, lock->context)) { in drm_legacy_unlock()
312 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_legacy_idlelock_release() local
318 old = *lock; in drm_legacy_idlelock_release()
319 prev = cmpxchg(lock, old, DRM_KERNEL_CONTEXT); in drm_legacy_idlelock_release()
334 return (file_priv->lock_count && master->lock.hw_lock && in drm_legacy_i_have_hw_lock()
335 _DRM_LOCK_IS_HELD(master->lock.hw_lock->lock) && in drm_legacy_i_have_hw_lock()
336 master->lock.file_priv == file_priv); in drm_legacy_i_have_hw_lock()
349 filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock)); in drm_legacy_lock_release()
350 drm_legacy_lock_free(&file_priv->master->lock, in drm_legacy_lock_release()
351 _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock)); in drm_legacy_lock_release()
365 if (master->lock.hw_lock) { in drm_legacy_lock_master_cleanup()
366 if (dev->sigdata.lock == master->lock.hw_lock) in drm_legacy_lock_master_cleanup()
367 dev->sigdata.lock = NULL; in drm_legacy_lock_master_cleanup()
368 master->lock.hw_lock = NULL; in drm_legacy_lock_master_cleanup()
369 master->lock.file_priv = NULL; in drm_legacy_lock_master_cleanup()
370 wake_up_interruptible_all(&master->lock.lock_queue); in drm_legacy_lock_master_cleanup()