Lines Matching refs:lock_data

47 static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
59 int drm_lock_take(struct drm_lock_data *lock_data, in drm_lock_take() argument
63 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_lock_take()
65 spin_lock_bh(&lock_data->spinlock); in drm_lock_take()
72 ((lock_data->user_waiters + lock_data->kernel_waiters > 1) ? in drm_lock_take()
77 spin_unlock_bh(&lock_data->spinlock); in drm_lock_take()
108 static int drm_lock_transfer(struct drm_lock_data *lock_data, in drm_lock_transfer() argument
112 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_lock_transfer()
114 lock_data->file_priv = NULL; in drm_lock_transfer()
123 static int drm_legacy_lock_free(struct drm_lock_data *lock_data, in drm_legacy_lock_free() argument
127 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_legacy_lock_free()
129 spin_lock_bh(&lock_data->spinlock); in drm_legacy_lock_free()
130 if (lock_data->kernel_waiters != 0) { in drm_legacy_lock_free()
131 drm_lock_transfer(lock_data, 0); in drm_legacy_lock_free()
132 lock_data->idle_has_lock = 1; in drm_legacy_lock_free()
133 spin_unlock_bh(&lock_data->spinlock); in drm_legacy_lock_free()
136 spin_unlock_bh(&lock_data->spinlock); in drm_legacy_lock_free()
149 wake_up_interruptible(&lock_data->lock_queue); in drm_legacy_lock_free()
290 void drm_legacy_idlelock_take(struct drm_lock_data *lock_data) in drm_legacy_idlelock_take() argument
294 spin_lock_bh(&lock_data->spinlock); in drm_legacy_idlelock_take()
295 lock_data->kernel_waiters++; in drm_legacy_idlelock_take()
296 if (!lock_data->idle_has_lock) { in drm_legacy_idlelock_take()
298 spin_unlock_bh(&lock_data->spinlock); in drm_legacy_idlelock_take()
299 ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); in drm_legacy_idlelock_take()
300 spin_lock_bh(&lock_data->spinlock); in drm_legacy_idlelock_take()
303 lock_data->idle_has_lock = 1; in drm_legacy_idlelock_take()
305 spin_unlock_bh(&lock_data->spinlock); in drm_legacy_idlelock_take()
309 void drm_legacy_idlelock_release(struct drm_lock_data *lock_data) in drm_legacy_idlelock_release() argument
312 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_legacy_idlelock_release()
314 spin_lock_bh(&lock_data->spinlock); in drm_legacy_idlelock_release()
315 if (--lock_data->kernel_waiters == 0) { in drm_legacy_idlelock_release()
316 if (lock_data->idle_has_lock) { in drm_legacy_idlelock_release()
321 wake_up_interruptible(&lock_data->lock_queue); in drm_legacy_idlelock_release()
322 lock_data->idle_has_lock = 0; in drm_legacy_idlelock_release()
325 spin_unlock_bh(&lock_data->spinlock); in drm_legacy_idlelock_release()