summaryrefslogtreecommitdiff
path: root/bsd-core/drm_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-core/drm_lock.c')
-rw-r--r--bsd-core/drm_lock.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c
index 631df8e1..31badd34 100644
--- a/bsd-core/drm_lock.c
+++ b/bsd-core/drm_lock.c
@@ -70,7 +70,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
DRM_LOCK();
for (;;) {
- if (drm_lock_take(&dev->lock.hw_lock->lock, lock->context)) {
+ if (drm_lock_take(&dev->lock, lock->context)) {
dev->lock.file_priv = file_priv;
dev->lock.lock_time = jiffies;
atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
@@ -129,9 +129,9 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);
DRM_LOCK();
- drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT);
+ drm_lock_transfer(&dev->lock, DRM_KERNEL_CONTEXT);
- if (drm_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) {
+ if (drm_lock_free(&dev->lock, DRM_KERNEL_CONTEXT)) {
DRM_ERROR("\n");
}
DRM_UNLOCK();
@@ -139,8 +139,9 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
return 0;
}
-int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
+int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context)
{
+ volatile unsigned int *lock = &lock_data->hw_lock->lock;
unsigned int old, new;
do {
@@ -169,12 +170,12 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
/* This takes a lock forcibly and hands it to context. Should ONLY be used
inside *_unlock to give lock to kernel before calling *_dma_schedule. */
-int drm_lock_transfer(struct drm_device *dev,
- __volatile__ unsigned int *lock, unsigned int context)
+int drm_lock_transfer(struct drm_lock_data *lock_data, unsigned int context)
{
+ volatile unsigned int *lock = &lock_data->hw_lock->lock;
unsigned int old, new;
- dev->lock.file_priv = NULL;
+ lock_data->file_priv = NULL;
do {
old = *lock;
new = context | _DRM_LOCK_HELD;
@@ -183,12 +184,12 @@ int drm_lock_transfer(struct drm_device *dev,
return 1;
}
-int drm_lock_free(struct drm_device *dev,
- __volatile__ unsigned int *lock, unsigned int context)
+int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
{
+ volatile unsigned int *lock = &lock_data->hw_lock->lock;
unsigned int old, new;
- dev->lock.file_priv = NULL;
+ lock_data->file_priv = NULL;
do {
old = *lock;
new = 0;
@@ -199,6 +200,6 @@ int drm_lock_free(struct drm_device *dev,
context, _DRM_LOCKING_CONTEXT(old));
return 1;
}
- DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
+ DRM_WAKEUP_INT((void *)&lock_data->lock_queue);
return 0;
}