Blob Blame History Raw
From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
Date: Tue, 7 Nov 2017 20:13:39 +0100
Subject: drm/print: Add drm_printf_indent()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: bf6234a294c5b8bcc6f47ecdb646f41ad5efddd3
Patch-mainline: v4.16-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

Add drm_printf_indent() that adds tab indentation according to argument.
Indentation overflow is marked with an X.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171107191348.17555-4-noralf@tronnes.org

Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 include/drm/drm_print.h |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -80,6 +80,14 @@ void __drm_printfn_debug(struct drm_prin
 __printf(2, 3)
 void drm_printf(struct drm_printer *p, const char *f, ...);
 
+/**
+ * drm_printf_indent - Print to a &drm_printer stream with indentation
+ * @printer: DRM printer
+ * @indent: Tab indentation level (max 5)
+ * @fmt: Format string
+ */
+#define drm_printf_indent(printer, indent, fmt, ...) \
+	drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__)
 
 /**
  * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file