summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_mm.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-12-16 10:46:41 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-12-16 16:31:06 +0300
commitad579002c8ec429930721c5bb8bd763e6c0c6286 (patch)
tree27c789dc98b2b341ea0c48336c460133a34be228 /drivers/gpu/drm/drm_mm.c
parent56e3d1cd05cc7b24cfcae8714b0661bf607aaba3 (diff)
downloadlinux-ad579002c8ec429930721c5bb8bd763e6c0c6286.tar.xz
drm: Add drm_mm_for_each_node_safe()
A complement to drm_mm_for_each_node(), wraps list_for_each_entry_safe() for walking the list of nodes safe against removal. Note from Joonas: "Most of the diff is about __drm_mm_nodes(mm), which could be split into own patch and keep the R-b's." But I don't feel like insisting on the resend. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> [danvet: Add note.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161216074718.32500-4-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/drm_mm.c')
-rw-r--r--drivers/gpu/drm/drm_mm.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index ca1e344f318d..6e0735539545 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -138,7 +138,7 @@ static void show_leaks(struct drm_mm *mm)
if (!buf)
return;
- list_for_each_entry(node, &mm->head_node.node_list, node_list) {
+ list_for_each_entry(node, __drm_mm_nodes(mm), node_list) {
struct stack_trace trace = {
.entries = entries,
.max_entries = STACKDEPTH
@@ -320,8 +320,7 @@ int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
if (hole->start < end)
return -ENOSPC;
} else {
- hole = list_entry(&mm->head_node.node_list,
- typeof(*hole), node_list);
+ hole = list_entry(__drm_mm_nodes(mm), typeof(*hole), node_list);
}
hole = list_last_entry(&hole->node_list, typeof(*hole), node_list);
@@ -884,7 +883,7 @@ EXPORT_SYMBOL(drm_mm_scan_remove_block);
*/
bool drm_mm_clean(struct drm_mm * mm)
{
- struct list_head *head = &mm->head_node.node_list;
+ struct list_head *head = __drm_mm_nodes(mm);
return (head->next->next == head);
}
@@ -930,7 +929,7 @@ EXPORT_SYMBOL(drm_mm_init);
*/
void drm_mm_takedown(struct drm_mm *mm)
{
- if (WARN(!list_empty(&mm->head_node.node_list),
+ if (WARN(!list_empty(__drm_mm_nodes(mm)),
"Memory manager not clean during takedown.\n"))
show_leaks(mm);