drm: Use drm_mm_nodes() as shorthand for the list of nodes under struct drm_mm
Fairly commonly we want to inspect the node list on the struct drm_mm,
which is buried within an embedded node. Bring it to the surface with a
bit of syntatic sugar.
Note this was intended to be split from commit ad579002c8
("drm: Add
drm_mm_for_each_node_safe()") before being applied, but my timing sucks.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-3-chris@chris-wilson.co.uk
This commit is contained in:

committed by
Daniel Vetter

parent
0bfd4a01a6
commit
2bc98c8651
@@ -138,7 +138,7 @@ static void show_leaks(struct drm_mm *mm)
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
list_for_each_entry(node, __drm_mm_nodes(mm), node_list) {
|
||||
list_for_each_entry(node, drm_mm_nodes(mm), node_list) {
|
||||
struct stack_trace trace = {
|
||||
.entries = entries,
|
||||
.max_entries = STACKDEPTH
|
||||
@@ -320,7 +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(__drm_mm_nodes(mm), 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);
|
||||
@@ -883,7 +883,7 @@ EXPORT_SYMBOL(drm_mm_scan_remove_block);
|
||||
*/
|
||||
bool drm_mm_clean(const struct drm_mm *mm)
|
||||
{
|
||||
const struct list_head *head = __drm_mm_nodes(mm);
|
||||
const struct list_head *head = drm_mm_nodes(mm);
|
||||
|
||||
return (head->next->next == head);
|
||||
}
|
||||
@@ -929,7 +929,7 @@ EXPORT_SYMBOL(drm_mm_init);
|
||||
*/
|
||||
void drm_mm_takedown(struct drm_mm *mm)
|
||||
{
|
||||
if (WARN(!list_empty(__drm_mm_nodes(mm)),
|
||||
if (WARN(!list_empty(drm_mm_nodes(mm)),
|
||||
"Memory manager not clean during takedown.\n"))
|
||||
show_leaks(mm);
|
||||
|
||||
|
Reference in New Issue
Block a user