Commit ac9bb7b7 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm: Simplify drm_mm_clean()

Since commit ea7b1dd4 ("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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-25-chris@chris-wilson.co.uk
parent c820186d
...@@ -872,22 +872,6 @@ bool drm_mm_scan_remove_block(struct drm_mm_node *node) ...@@ -872,22 +872,6 @@ bool drm_mm_scan_remove_block(struct drm_mm_node *node)
} }
EXPORT_SYMBOL(drm_mm_scan_remove_block); 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 * drm_mm_init - initialize a drm-mm allocator
* @mm: the drm_mm structure to initialize * @mm: the drm_mm structure to initialize
...@@ -928,10 +912,9 @@ EXPORT_SYMBOL(drm_mm_init); ...@@ -928,10 +912,9 @@ EXPORT_SYMBOL(drm_mm_init);
*/ */
void drm_mm_takedown(struct drm_mm *mm) 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")) "Memory manager not clean during takedown.\n"))
show_leaks(mm); show_leaks(mm);
} }
EXPORT_SYMBOL(drm_mm_takedown); EXPORT_SYMBOL(drm_mm_takedown);
......
...@@ -342,7 +342,19 @@ void drm_mm_remove_node(struct drm_mm_node *node); ...@@ -342,7 +342,19 @@ void drm_mm_remove_node(struct drm_mm_node *node);
void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
void drm_mm_init(struct drm_mm *mm, u64 start, u64 size); void drm_mm_init(struct drm_mm *mm, u64 start, u64 size);
void drm_mm_takedown(struct drm_mm *mm); void drm_mm_takedown(struct drm_mm *mm);
bool drm_mm_clean(const struct drm_mm *mm);
/**
* 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.
*/
static inline bool drm_mm_clean(const struct drm_mm *mm)
{
return list_empty(drm_mm_nodes(mm));
}
struct drm_mm_node * struct drm_mm_node *
__drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last); __drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last);
......
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