summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-02-18 17:59:15 +0100
committerDave Airlie <airlied@redhat.com>2011-02-23 10:32:57 +1000
commitae0cec2880a4dc6d90c7f8392bdc6705988389ca (patch)
tree02a36c6ff5eb3e9f0554d9b5134ab374929c61fb /include/drm
parentb0b7af1884b7d807a3504804f9825d472de78708 (diff)
downloadlinux-3.10-ae0cec2880a4dc6d90c7f8392bdc6705988389ca.tar.gz
linux-3.10-ae0cec2880a4dc6d90c7f8392bdc6705988389ca.tar.bz2
linux-3.10-ae0cec2880a4dc6d90c7f8392bdc6705988389ca.zip
drm: mm: add helper to unwind scan state
With the switch to implicit free space accounting one pointer got unused when scanning. Use it to create a single-linked list to ensure correct unwinding of the scan state. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_mm.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 17a070e11d3..b1e7809e5e1 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -72,6 +72,7 @@ struct drm_mm {
unsigned scanned_blocks;
unsigned long scan_start;
unsigned long scan_end;
+ struct drm_mm_node *prev_scanned_node;
};
static inline bool drm_mm_node_allocated(struct drm_mm_node *node)
@@ -86,6 +87,13 @@ static inline bool drm_mm_initialized(struct drm_mm *mm)
#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \
&(mm)->head_node.node_list, \
node_list);
+#define drm_mm_for_each_scanned_node_reverse(entry, n, mm) \
+ for (entry = (mm)->prev_scanned_node, \
+ next = entry ? list_entry(entry->node_list.next, \
+ struct drm_mm_node, node_list) : NULL; \
+ entry != NULL; entry = next, \
+ next = entry ? list_entry(entry->node_list.next, \
+ struct drm_mm_node, node_list) : NULL) \
/*
* Basic range manager support (drm_mm.c)
*/