diff mbox

[2/9] drm: Recognize invalid (all-zero) modes in drm_mode_debug_printmodeline(_raw)

Message ID 1461751622-26927-3-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin April 27, 2016, 10:06 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Instead of a long string full of zeros in various forms
print out "---" for more tidy appearace in the logs.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/drm_modes.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index fd4795e2c8db..da9012dc4bba 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -49,13 +49,26 @@ 
  */
 void drm_mode_debug_printmodeline_raw(const struct drm_display_mode *mode)
 {
-	if (drm_debug & DRM_UT_KMS)
+	if (!(drm_debug & DRM_UT_KMS))
+		return;
+
+	if (mode->base.id == 0 &&
+	    (mode->name == NULL || mode->name[0] == 0) &&
+	    mode->vrefresh == 0 && mode->clock == 0 &&
+	    mode->hdisplay == 0 && mode->hsync_start == 0 &&
+	    mode->hsync_end == 0 && mode->htotal == 0 &&
+	    mode->vdisplay == 0 && mode->vsync_start == 0 &&
+	    mode->vsync_end == 0 && mode->vtotal == 0 &&
+	    mode->type == 0 && mode->flags == 0) {
+		printk("---");
+	} else {
 		printk("%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
-		       mode->base.id, mode->name, mode->vrefresh, mode->clock,
-		       mode->hdisplay, mode->hsync_start,
-		       mode->hsync_end, mode->htotal,
-		       mode->vdisplay, mode->vsync_start,
-		       mode->vsync_end, mode->vtotal, mode->type, mode->flags);
+			mode->base.id, mode->name, mode->vrefresh, mode->clock,
+			mode->hdisplay, mode->hsync_start,
+			mode->hsync_end, mode->htotal,
+			mode->vdisplay, mode->vsync_start,
+			mode->vsync_end, mode->vtotal, mode->type, mode->flags);
+	}
 }
 EXPORT_SYMBOL(drm_mode_debug_printmodeline_raw);