diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-07-01 16:01:02 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-07-03 20:01:00 -0400 |
commit | 2c54b133576fefaa54a0ab939a94af348ec54499 (patch) | |
tree | 9c3b4ad1494601373d2c340748cb6cc88977ccb9 | |
parent | 4a88f73f14f6d6c94616538427e1235a6d0a5885 (diff) |
drm/mm: fix debug table BUG
In
commit 3a359f0b21ab218c1bf7a6a1b638b6fd143d0b99
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Sat Apr 20 12:08:11 2013 +0200
drm/mm: fix dump table BUG
I've failed to fix both instances of the regression introduced in
commit 9e8944ab564f2e3dde90a518cd32048c58918608
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Nov 15 11:32:17 2012 +0000
drm: Introduce an iterator over holes in the drm_mm range manager
Patch this up in the same way by extracting the hole debug logic
into it's own function, since that'll also clarify the logic a bit.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 7917729ee61d..e05c3cea322c 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -714,36 +714,37 @@ void drm_mm_takedown(struct drm_mm * mm) | |||
714 | } | 714 | } |
715 | EXPORT_SYMBOL(drm_mm_takedown); | 715 | EXPORT_SYMBOL(drm_mm_takedown); |
716 | 716 | ||
717 | void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) | 717 | static unsigned long drm_mm_debug_hole(struct drm_mm_node *entry, |
718 | const char *prefix) | ||
718 | { | 719 | { |
719 | struct drm_mm_node *entry; | ||
720 | unsigned long total_used = 0, total_free = 0, total = 0; | ||
721 | unsigned long hole_start, hole_end, hole_size; | 720 | unsigned long hole_start, hole_end, hole_size; |
722 | 721 | ||
723 | hole_start = drm_mm_hole_node_start(&mm->head_node); | 722 | if (entry->hole_follows) { |
724 | hole_end = drm_mm_hole_node_end(&mm->head_node); | 723 | hole_start = drm_mm_hole_node_start(entry); |
725 | hole_size = hole_end - hole_start; | 724 | hole_end = drm_mm_hole_node_end(entry); |
726 | if (hole_size) | 725 | hole_size = hole_end - hole_start; |
727 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", | 726 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", |
728 | prefix, hole_start, hole_end, | 727 | prefix, hole_start, hole_end, |
729 | hole_size); | 728 | hole_size); |
730 | total_free += hole_size; | 729 | return hole_size; |
730 | } | ||
731 | |||
732 | return 0; | ||
733 | } | ||
734 | |||
735 | void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) | ||
736 | { | ||
737 | struct drm_mm_node *entry; | ||
738 | unsigned long total_used = 0, total_free = 0, total = 0; | ||
739 | |||
740 | total_free += drm_mm_debug_hole(&mm->head_node, prefix); | ||
731 | 741 | ||
732 | drm_mm_for_each_node(entry, mm) { | 742 | drm_mm_for_each_node(entry, mm) { |
733 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: used\n", | 743 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: used\n", |
734 | prefix, entry->start, entry->start + entry->size, | 744 | prefix, entry->start, entry->start + entry->size, |
735 | entry->size); | 745 | entry->size); |
736 | total_used += entry->size; | 746 | total_used += entry->size; |
737 | 747 | total_free += drm_mm_debug_hole(entry, prefix); | |
738 | if (entry->hole_follows) { | ||
739 | hole_start = drm_mm_hole_node_start(entry); | ||
740 | hole_end = drm_mm_hole_node_end(entry); | ||
741 | hole_size = hole_end - hole_start; | ||
742 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", | ||
743 | prefix, hole_start, hole_end, | ||
744 | hole_size); | ||
745 | total_free += hole_size; | ||
746 | } | ||
747 | } | 748 | } |
748 | total = total_free + total_used; | 749 | total = total_free + total_used; |
749 | 750 | ||