diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-07-23 03:01:12 -0400 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-08-05 10:07:45 -0400 |
commit | 9f8d21ea276177547725a60cefc1b6da742f14d3 (patch) | |
tree | 1511b996ef09915f43246b7ecf145b2bd2ac349b /drivers/gpu/drm/drm_fops.c | |
parent | a91576d7916f6cce76d30303e60e1ac47cf4a76d (diff) |
drm: extract legacy ctxbitmap flushing
The ctxbitmap code is only used by legacy drivers so lets try to keep it
as separated as possible. Furthermore, the locking is non-obvious and
kinda weird with ctxlist_mutex *and* struct_mutex. Keeping all ctxbitmap
access in one file is much easier to review and makes drm_release() more
readable.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index bc583fe51e45..55143f7747f3 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -457,25 +457,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
457 | if (dev->driver->driver_features & DRIVER_GEM) | 457 | if (dev->driver->driver_features & DRIVER_GEM) |
458 | drm_gem_release(dev, file_priv); | 458 | drm_gem_release(dev, file_priv); |
459 | 459 | ||
460 | mutex_lock(&dev->ctxlist_mutex); | 460 | drm_ctxbitmap_flush(dev, file_priv); |
461 | if (!list_empty(&dev->ctxlist)) { | ||
462 | struct drm_ctx_list *pos, *n; | ||
463 | |||
464 | list_for_each_entry_safe(pos, n, &dev->ctxlist, head) { | ||
465 | if (pos->tag == file_priv && | ||
466 | pos->handle != DRM_KERNEL_CONTEXT) { | ||
467 | if (dev->driver->context_dtor) | ||
468 | dev->driver->context_dtor(dev, | ||
469 | pos->handle); | ||
470 | |||
471 | drm_ctxbitmap_free(dev, pos->handle); | ||
472 | |||
473 | list_del(&pos->head); | ||
474 | kfree(pos); | ||
475 | } | ||
476 | } | ||
477 | } | ||
478 | mutex_unlock(&dev->ctxlist_mutex); | ||
479 | 461 | ||
480 | mutex_lock(&dev->master_mutex); | 462 | mutex_lock(&dev->master_mutex); |
481 | 463 | ||