Commit ea5e4374 authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm/sis: clean up reclaim_buffers

Like for via.

v2: Actually drop the idlelock again if taken.

v3: Fixup.

v4: Fixup the "has master" vs. "is master" confusion the refactor
introduced.

v5: Drop the idlelock in the early return path.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 834859c3
...@@ -105,10 +105,9 @@ static struct drm_driver driver = { ...@@ -105,10 +105,9 @@ static struct drm_driver driver = {
.load = sis_driver_load, .load = sis_driver_load,
.unload = sis_driver_unload, .unload = sis_driver_unload,
.open = sis_driver_open, .open = sis_driver_open,
.preclose = sis_reclaim_buffers_locked,
.postclose = sis_driver_postclose, .postclose = sis_driver_postclose,
.dma_quiescent = sis_idle, .dma_quiescent = sis_idle,
.reclaim_buffers = NULL,
.reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
.lastclose = sis_lastclose, .lastclose = sis_lastclose,
.ioctls = sis_ioctls, .ioctls = sis_ioctls,
.fops = &sis_driver_fops, .fops = &sis_driver_fops,
......
...@@ -321,14 +321,20 @@ void sis_reclaim_buffers_locked(struct drm_device *dev, ...@@ -321,14 +321,20 @@ void sis_reclaim_buffers_locked(struct drm_device *dev,
struct sis_file_private *file_priv = file->driver_priv; struct sis_file_private *file_priv = file->driver_priv;
struct sis_memblock *entry, *next; struct sis_memblock *entry, *next;
if (!(file->minor->master && file->master->lock.hw_lock))
return;
drm_idlelock_take(&file->master->lock);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (list_empty(&file_priv->obj_list)) { if (list_empty(&file_priv->obj_list)) {
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
drm_idlelock_release(&file->master->lock);
return; return;
} }
if (dev->driver->dma_quiescent) sis_idle(dev);
dev->driver->dma_quiescent(dev);
list_for_each_entry_safe(entry, next, &file_priv->obj_list, list_for_each_entry_safe(entry, next, &file_priv->obj_list,
...@@ -343,6 +349,9 @@ void sis_reclaim_buffers_locked(struct drm_device *dev, ...@@ -343,6 +349,9 @@ void sis_reclaim_buffers_locked(struct drm_device *dev,
kfree(entry); kfree(entry);
} }
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
drm_idlelock_release(&file->master->lock);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment