summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/via/via_mm.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-10-25 23:37:09 +0200
committerDave Airlie <airlied@redhat.com>2012-07-19 22:48:28 -0400
commit834859c3abf9272bf55bd0d0c95e5a892f24dadc (patch)
tree2029970d5992422f8e7cecdcc893e0d167599bcd /drivers/gpu/drm/via/via_mm.c
parent5bd42f69fbedfc12cd8161323a9ffab0b2586a2a (diff)
downloadlinux-stable-834859c3abf9272bf55bd0d0c95e5a892f24dadc.tar.gz
linux-stable-834859c3abf9272bf55bd0d0c95e5a892f24dadc.tar.bz2
linux-stable-834859c3abf9272bf55bd0d0c95e5a892f24dadc.zip
drm/via: clean up reclaim_buffers
A few things - kill reclaim_buffers, it's never ever called because via does not set DRIVER_HAVE_DMA - inline the idlelock dance into the buffer reclaim logic and make it a simple preclose cleanup function - directly call the the dma_quiescent function and kill the needless if check. v2: Actually drop the idlelock when we take it. Reported by James Simmons. v3: Rebased onto latest drm-next. v4: Fixup the refactor. v5: More fixup the refactor - I've accidentally changed the check for any master to checking whether the closing fd is the master. v6: Don't forget to drop the idlelock in the early return path, too. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/via/via_mm.c')
-rw-r--r--drivers/gpu/drm/via/via_mm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index a3574d09a07d..acfcb358e7b7 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -215,14 +215,20 @@ void via_reclaim_buffers_locked(struct drm_device *dev,
struct via_file_private *file_priv = file->driver_priv;
struct via_memblock *entry, *next;
+ if (!(file->minor->master && file->master->lock.hw_lock))
+ return;
+
+ drm_idlelock_take(&file->master->lock);
+
mutex_lock(&dev->struct_mutex);
if (list_empty(&file_priv->obj_list)) {
mutex_unlock(&dev->struct_mutex);
+ drm_idlelock_release(&file->master->lock);
+
return;
}
- if (dev->driver->dma_quiescent)
- dev->driver->dma_quiescent(dev);
+ via_driver_dma_quiescent(dev);
list_for_each_entry_safe(entry, next, &file_priv->obj_list,
owner_list) {
@@ -231,5 +237,8 @@ void via_reclaim_buffers_locked(struct drm_device *dev,
kfree(entry);
}
mutex_unlock(&dev->struct_mutex);
+
+ drm_idlelock_release(&file->master->lock);
+
return;
}