summaryrefslogtreecommitdiff
path: root/bsd-core
diff options
context:
space:
mode:
authorvehemens <vehemens@verizon.net>2008-09-06 15:33:47 -0700
committerRobert Noland <rnoland@2hip.net>2008-09-06 18:55:03 -0400
commit9ad5a6d0d73ba58ec7c2f66d0c5355185f2f68c6 (patch)
tree5e1c0c1e6e5dd634d5ef10e8be9b8c6a3715fe11 /bsd-core
parentb8a9cebddc7063bc0dae889dac43359c0cb9bfa5 (diff)
Pass lock data like linux and open.
Signed-off-by: Robert Noland <rnoland@2hip.net>
Diffstat (limited to 'bsd-core')
-rw-r--r--bsd-core/drmP.h10
-rw-r--r--bsd-core/drm_drv.c8
-rw-r--r--bsd-core/drm_irq.c4
-rw-r--r--bsd-core/drm_lock.c23
4 files changed, 21 insertions, 24 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 7244b353..f8705e36 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -911,13 +911,11 @@ void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
int drm_ctxbitmap_next(struct drm_device *dev);
/* Locking IOCTL support (drm_lock.c) */
-int drm_lock_take(__volatile__ unsigned int *lock,
- unsigned int context);
-int drm_lock_transfer(struct drm_device *dev,
- __volatile__ unsigned int *lock,
+int drm_lock_take(struct drm_lock_data *lock_data,
+ unsigned int context);
+int drm_lock_transfer(struct drm_lock_data *lock_data,
unsigned int context);
-int drm_lock_free(struct drm_device *dev,
- __volatile__ unsigned int *lock,
+int drm_lock_free(struct drm_lock_data *lock_data,
unsigned int context);
/* Buffer management support (drm_bufs.c) */
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 860b8282..b40d1da4 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -774,7 +774,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
if (dev->driver->reclaim_buffers_locked != NULL)
dev->driver->reclaim_buffers_locked(dev, file_priv);
- drm_lock_free(dev, &dev->lock.hw_lock->lock,
+ drm_lock_free(&dev->lock,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
/* FIXME: may require heavy-handed reset of
@@ -790,8 +790,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
retcode = EINTR;
break;
}
- if (drm_lock_take(&dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT)) {
+ if (drm_lock_take(&dev->lock, DRM_KERNEL_CONTEXT)) {
dev->lock.file_priv = file_priv;
dev->lock.lock_time = jiffies;
atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
@@ -810,8 +809,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
}
if (retcode == 0) {
dev->driver->reclaim_buffers_locked(dev, file_priv);
- drm_lock_free(dev, &dev->lock.hw_lock->lock,
- DRM_KERNEL_CONTEXT);
+ drm_lock_free(&dev->lock, DRM_KERNEL_CONTEXT);
}
}
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
index 08a0dbc4..e3a4cb6a 100644
--- a/bsd-core/drm_irq.c
+++ b/bsd-core/drm_irq.c
@@ -540,7 +540,7 @@ static void drm_locked_task(void *context, int pending __unused)
DRM_LOCK(); /* XXX drm_lock_take() should do it's own locking */
if (dev->locked_task_call == NULL ||
- drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT) == 0) {
+ drm_lock_take(&dev->lock, DRM_KERNEL_CONTEXT) == 0) {
DRM_UNLOCK();
DRM_SPINUNLOCK(&dev->tsk_lock);
return;
@@ -554,7 +554,7 @@ static void drm_locked_task(void *context, int pending __unused)
dev->locked_task_call(dev);
- drm_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT);
+ drm_lock_free(&dev->lock, DRM_KERNEL_CONTEXT);
dev->locked_task_call = NULL;
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;
}