[PATCH] drm/buddy: Fix drm_buddy_print() to work with printk printers
Michal Wajdeczko
michal.wajdeczko at intel.com
Mon Jul 15 16:58:47 UTC 2024
If we try to use printk-based drm_printer, like drm_dbg_printer(),
output from drm_buddy_print() will be split into several lines:
[drm] chunk_size: 1024KiB, total: 7MiB, free: 7MiB, clear_free: 0MiB
[drm] order- 2
[drm] free: 4 MiB
[drm] , blocks: 1
[drm] order- 1
[drm] free: 2 MiB
[drm] , blocks: 1
[drm] order- 0
[drm] free: 1 MiB
[drm] , blocks: 1
Fix that by using single drm_printf() per line.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam at amd.com>
---
drivers/gpu/drm/drm_buddy.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
index 6a8e45e9d0ec..474a4689269b 100644
--- a/drivers/gpu/drm/drm_buddy.c
+++ b/drivers/gpu/drm/drm_buddy.c
@@ -1139,15 +1139,10 @@ void drm_buddy_print(struct drm_buddy *mm, struct drm_printer *p)
count++;
}
- drm_printf(p, "order-%2d ", order);
-
free = count * (mm->chunk_size << order);
- if (free < SZ_1M)
- drm_printf(p, "free: %8llu KiB", free >> 10);
- else
- drm_printf(p, "free: %8llu MiB", free >> 20);
-
- drm_printf(p, ", blocks: %llu\n", count);
+ drm_printf(p, "order-%2d free: %8llu %s, blocks: %llu\n",
+ order, free >> (free < SZ_1M ? 10 : 20),
+ free < SZ_1M ? "KiB" : "MiB", count);
}
}
EXPORT_SYMBOL(drm_buddy_print);
--
2.43.0
More information about the dri-devel
mailing list