summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-02-15 10:03:16 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-02-15 10:03:16 +0000
commitb3dbb00aafdbc342fe93b6ed5ab98dfa7ac362cd (patch)
tree85ab1018a84d0dd656a7f7319edd6412bb0a91b7 /sys
parenta7d790e475f483197b0e5d5aa94a3543fcb3079e (diff)
drm/mm: fix dump table BUG
From Daniel Vetter c565ce76dab93e16a2deb68fb70a26b635f3ab5b in ubuntu 3.8 3a359f0b21ab218c1bf7a6a1b638b6fd143d0b99 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/drm_mm.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sys/dev/pci/drm/drm_mm.c b/sys/dev/pci/drm/drm_mm.c
index 70e9ed3375f..de8dc64350d 100644
--- a/sys/dev/pci/drm/drm_mm.c
+++ b/sys/dev/pci/drm/drm_mm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_mm.c,v 1.2 2013/09/12 13:03:31 jsg Exp $ */
+/* $OpenBSD: drm_mm.c,v 1.3 2014/02/15 10:03:15 jsg Exp $ */
/**************************************************************************
*
* Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA.
@@ -721,33 +721,35 @@ void drm_mm_debug_table(struct drm_mm *mm, const char *prefix)
EXPORT_SYMBOL(drm_mm_debug_table);
#if defined(CONFIG_DEBUG_FS)
-int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm)
+static unsigned long drm_mm_dump_hole(struct seq_file *m, struct drm_mm_node *entry)
{
- struct drm_mm_node *entry;
- unsigned long total_used = 0, total_free = 0, total = 0;
unsigned long hole_start, hole_end, hole_size;
- hole_start = drm_mm_hole_node_start(&mm->head_node);
- hole_end = drm_mm_hole_node_end(&mm->head_node);
- hole_size = hole_end - hole_start;
- if (hole_size)
+ if (entry->hole_follows) {
+ hole_start = drm_mm_hole_node_start(entry);
+ hole_end = drm_mm_hole_node_end(entry);
+ hole_size = hole_end - hole_start;
seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n",
hole_start, hole_end, hole_size);
- total_free += hole_size;
+ return hole_size;
+ }
+
+ return 0;
+}
+
+int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm)
+{
+ struct drm_mm_node *entry;
+ unsigned long total_used = 0, total_free = 0, total = 0;
+
+ total_free += drm_mm_dump_hole(m, &mm->head_node);
drm_mm_for_each_node(entry, mm) {
seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: used\n",
entry->start, entry->start + entry->size,
entry->size);
total_used += entry->size;
- if (entry->hole_follows) {
- hole_start = drm_mm_hole_node_start(entry);
- hole_end = drm_mm_hole_node_end(entry);
- hole_size = hole_end - hole_start;
- seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n",
- hole_start, hole_end, hole_size);
- total_free += hole_size;
- }
+ total_free += drm_mm_dump_hole(m, entry);
}
total = total_free + total_used;