All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/sched: Define pr_fmt() for DRM using pr_*()
@ 2023-11-10  0:27 Luben Tuikov
  2023-11-10  0:58 ` Danilo Krummrich
  2023-11-10 12:40 ` Jani Nikula
  0 siblings, 2 replies; 10+ messages in thread
From: Luben Tuikov @ 2023-11-10  0:27 UTC (permalink / raw)
  To: Direct Rendering Infrastructure - Development, Danilo Krummrich
  Cc: Luben Tuikov

Define pr_fmt() as "[drm] " for DRM code using pr_*() facilities, especially
when no devices are available. This makes it easier to browse kernel logs.

Signed-off-by: Luben Tuikov <ltuikov89@gmail.com>
---
 include/drm/drm_print.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index a93a387f8a1a15..e8fe60d0eb8783 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -26,6 +26,20 @@
 #ifndef DRM_PRINT_H_
 #define DRM_PRINT_H_
 
+/* Define this before including linux/printk.h, so that the format
+ * string in pr_*() macros is correctly set for DRM. If a file wants
+ * to define this to something else, it should do so before including
+ * this header file.
+ *
+ * It is encouraged code using pr_err() to prefix their format with
+ * the string "*ERROR* ", to make it easier to scan kernel logs. For
+ * instance,
+ *   pr_err("*ERROR* <the rest of your format string here>", args).
+ */
+#ifndef pr_fmt
+#define pr_fmt(fmt) "[drm] " fmt
+#endif
+
 #include <linux/compiler.h>
 #include <linux/printk.h>
 #include <linux/seq_file.h>

base-commit: f3123c2590005c5ff631653d31428e40cd10c618
-- 
2.42.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-11-17  3:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-10  0:27 [PATCH] drm/sched: Define pr_fmt() for DRM using pr_*() Luben Tuikov
2023-11-10  0:58 ` Danilo Krummrich
2023-11-10 12:40 ` Jani Nikula
2023-11-10 12:44   ` Jani Nikula
2023-11-10 13:58   ` Luben Tuikov
2023-11-14  1:04   ` Luben Tuikov
2023-11-14 12:20     ` Jani Nikula
2023-11-14 23:57       ` Luben Tuikov
2023-11-15  8:24         ` Jani Nikula
2023-11-17  3:22           ` Luben Tuikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.