diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-12-22 09:36:27 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-12-27 14:16:59 +0100 |
commit | ac9bb7b7d33f6be9e333b24786a774145cc8c59e (patch) | |
tree | e65f935a8201865a8dfea93b1997b6d4570feb19 /drivers/gpu/drm/drm_mm.c | |
parent | drm: Detect overflow in drm_mm_reserve_node() (diff) | |
download | linux-ac9bb7b7d33f6be9e333b24786a774145cc8c59e.tar.xz linux-ac9bb7b7d33f6be9e333b24786a774145cc8c59e.zip |
drm: Simplify drm_mm_clean()
Since commit ea7b1dd44867 ("drm: mm: track free areas implicitly"),
to test whether there are any nodes allocated within the range manager,
we merely have to ask whether the node_list is empty.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-25-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/drm_mm.c')
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 370cb8ee91c9..e0419cf09bbb 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c @@ -873,22 +873,6 @@ bool drm_mm_scan_remove_block(struct drm_mm_node *node) EXPORT_SYMBOL(drm_mm_scan_remove_block); /** - * drm_mm_clean - checks whether an allocator is clean - * @mm: drm_mm allocator to check - * - * Returns: - * True if the allocator is completely free, false if there's still a node - * allocated in it. - */ -bool drm_mm_clean(const struct drm_mm *mm) -{ - const struct list_head *head = drm_mm_nodes(mm); - - return (head->next->next == head); -} -EXPORT_SYMBOL(drm_mm_clean); - -/** * drm_mm_init - initialize a drm-mm allocator * @mm: the drm_mm structure to initialize * @start: start of the range managed by @mm @@ -928,10 +912,9 @@ EXPORT_SYMBOL(drm_mm_init); */ void drm_mm_takedown(struct drm_mm *mm) { - if (WARN(!list_empty(drm_mm_nodes(mm)), + if (WARN(!drm_mm_clean(mm), "Memory manager not clean during takedown.\n")) show_leaks(mm); - } EXPORT_SYMBOL(drm_mm_takedown); |