All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm: Extract drm_debug.[hc]
       [not found] <cover.1507693829.git.hamohammed.sa@gmail.com>
@ 2017-10-11  4:13   ` Haneen Mohammed
  2017-10-11  4:16   ` Haneen Mohammed
  1 sibling, 0 replies; 16+ messages in thread
From: Haneen Mohammed @ 2017-10-11  4:13 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Daniel Vetter, outreachy-kernel, gregkh

Extract DRM_* debug macros from drmP.h to drm_debug.h and move printting
related functions from drm_drv.[hc] to drm_debug.[hc].

Update kerneldoc include directives accordingly.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
 Documentation/gpu/drm-uapi.rst |   9 ++
 drivers/gpu/drm/Makefile       |   2 +-
 drivers/gpu/drm/drm_debug.c    |  75 ++++++++++++++++
 drivers/gpu/drm/drm_drv.c      |  47 ----------
 include/drm/drmP.h             | 149 +------------------------------
 include/drm/drm_debug.h        | 193 +++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_drv.h          |   7 --
 7 files changed, 279 insertions(+), 203 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_debug.c
 create mode 100644 include/drm/drm_debug.h

diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
index 679373b..9a374e6 100644
--- a/Documentation/gpu/drm-uapi.rst
+++ b/Documentation/gpu/drm-uapi.rst
@@ -235,6 +235,15 @@ Debugfs Support
 .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c
    :export:
 
+Debug Support
+-------------
+
+.. kernel-doc:: include/drm/drm_debug.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/drm_debug.c
+   :export:
+
 Sysfs Support
 =============
 
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index a8acc19..d09bd06 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -3,7 +3,7 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
-		drm_context.o drm_dma.o \
+		drm_context.o drm_dma.o drm_debug.o \
 		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
 		drm_lock.o drm_memory.o drm_drv.o \
 		drm_scatter.o drm_pci.o \
diff --git a/drivers/gpu/drm/drm_debug.c b/drivers/gpu/drm/drm_debug.c
new file mode 100644
index 0000000..a79593f
--- /dev/null
+++ b/drivers/gpu/drm/drm_debug.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Author Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <drm/drm_debug.h>
+#include <drm/drmP.h>
+
+#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
+
+void drm_dev_printk(const struct device *dev, const char *level,
+		    unsigned int category, const char *function_name,
+		    const char *prefix, const char *format, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	if (category != DRM_UT_NONE && !(drm_debug & category))
+		return;
+
+	va_start(args, format);
+	vaf.fmt = format;
+	vaf.va = &args;
+
+	if (dev)
+		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
+			   &vaf);
+	else
+		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
+
+	va_end(args);
+}
+EXPORT_SYMBOL(drm_dev_printk);
+
+void drm_printk(const char *level, unsigned int category,
+		const char *format, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	if (category != DRM_UT_NONE && !(drm_debug & category))
+		return;
+
+	va_start(args, format);
+	vaf.fmt = format;
+	vaf.va = &args;
+
+	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
+	       level, __builtin_return_address(0),
+	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
+
+	va_end(args);
+}
+EXPORT_SYMBOL(drm_printk);
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index be38ac7..9710c78 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -74,53 +74,6 @@ static bool drm_core_init_complete = false;
 
 static struct dentry *drm_debugfs_root;
 
-#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
-
-void drm_dev_printk(const struct device *dev, const char *level,
-		    unsigned int category, const char *function_name,
-		    const char *prefix, const char *format, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	if (category != DRM_UT_NONE && !(drm_debug & category))
-		return;
-
-	va_start(args, format);
-	vaf.fmt = format;
-	vaf.va = &args;
-
-	if (dev)
-		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
-			   &vaf);
-	else
-		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(drm_dev_printk);
-
-void drm_printk(const char *level, unsigned int category,
-		const char *format, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	if (category != DRM_UT_NONE && !(drm_debug & category))
-		return;
-
-	va_start(args, format);
-	vaf.fmt = format;
-	vaf.va = &args;
-
-	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
-	       level, __builtin_return_address(0),
-	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(drm_printk);
-
 /*
  * DRM Minors
  * A DRM device can provide several char-dev interfaces on the DRM-Major. Each
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7277783a..8186a96 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -77,6 +77,7 @@
 #include <drm/drm_prime.h>
 #include <drm/drm_pci.h>
 #include <drm/drm_file.h>
+#include <drm/drm_debug.h>
 #include <drm/drm_debugfs.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_sysfs.h>
@@ -142,154 +143,6 @@ struct pci_controller;
 /*@{*/
 
 /***********************************************************************/
-/** \name Macros to make printk easier */
-/*@{*/
-
-#define _DRM_PRINTK(once, level, fmt, ...)				\
-	do {								\
-		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
-			     ##__VA_ARGS__);				\
-	} while (0)
-
-#define DRM_INFO(fmt, ...)						\
-	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
-#define DRM_NOTE(fmt, ...)						\
-	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
-#define DRM_WARN(fmt, ...)						\
-	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
-
-#define DRM_INFO_ONCE(fmt, ...)						\
-	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
-#define DRM_NOTE_ONCE(fmt, ...)						\
-	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
-#define DRM_WARN_ONCE(fmt, ...)						\
-	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
-
-/**
- * Error output.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_ERROR(dev, fmt, ...)					\
-	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
-		       fmt, ##__VA_ARGS__)
-#define DRM_ERROR(fmt, ...)						\
-	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
-
-/**
- * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
-({									\
-	static DEFINE_RATELIMIT_STATE(_rs,				\
-				      DEFAULT_RATELIMIT_INTERVAL,	\
-				      DEFAULT_RATELIMIT_BURST);		\
-									\
-	if (__ratelimit(&_rs))						\
-		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
-})
-#define DRM_ERROR_RATELIMITED(fmt, ...)					\
-	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_INFO(dev, fmt, ...)					\
-	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
-		       ##__VA_ARGS__)
-
-#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
-({									\
-	static bool __print_once __read_mostly;				\
-	if (!__print_once) {						\
-		__print_once = true;					\
-		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
-	}								\
-})
-
-/**
- * Debug output.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_DEBUG(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
-		       ##args)
-#define DRM_DEBUG(fmt, ...)						\
-	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
-		       fmt, ##args)
-#define DRM_DEBUG_DRIVER(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
-		       ##args)
-#define DRM_DEBUG_KMS(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
-		       fmt, ##args)
-#define DRM_DEBUG_PRIME(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
-		       fmt, ##args)
-#define DRM_DEBUG_ATOMIC(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
-		       ##args)
-#define DRM_DEBUG_VBL(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
-
-#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
-({									\
-	static DEFINE_RATELIMIT_STATE(_rs,				\
-				      DEFAULT_RATELIMIT_INTERVAL,	\
-				      DEFAULT_RATELIMIT_BURST);		\
-	if (__ratelimit(&_rs))						\
-		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
-			       __func__, "", fmt, ##args);		\
-})
-
-/**
- * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
-	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
-#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
-	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
-#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
-#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
-	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
-#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
-#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
-	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
-#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
-#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
-	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
-
-/* Format strings and argument splitters to simplify printing
- * various "complex" objects
- */
-
-/*@}*/
-
-/***********************************************************************/
 /** \name Internal types and structures */
 /*@{*/
 
diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
new file mode 100644
index 0000000..24fbea4
--- /dev/null
+++ b/include/drm/drm_debug.h
@@ -0,0 +1,193 @@
+/*
+ * Internal Header for the Direct Rendering Manager
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * Copyright (c) 2009-2010, Code Aurora Forum.
+ * All rights reserved.
+ *
+ * Author: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Author: Gareth Hughes <gareth@valinux.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _DRM_DEBUG_H_
+#define _DRM_DEBUG_H_
+
+#include <linux/kernel.h>
+
+__printf(6, 7)
+void drm_dev_printk(const struct device *dev, const char *level,
+		    unsigned int category, const char *function_name,
+		    const char *prefix, const char *format, ...);
+__printf(3, 4)
+void drm_printk(const char *level, unsigned int category,
+		const char *format, ...);
+
+/***********************************************************************/
+/** \name Macros to make printk easier */
+/*@{*/
+
+#define _DRM_PRINTK(once, level, fmt, ...)				\
+	do {								\
+		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
+			     ##__VA_ARGS__);				\
+	} while (0)
+
+#define DRM_INFO(fmt, ...)						\
+	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
+#define DRM_NOTE(fmt, ...)						\
+	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
+#define DRM_WARN(fmt, ...)						\
+	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
+
+#define DRM_INFO_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
+#define DRM_NOTE_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
+#define DRM_WARN_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
+
+/**
+ * Error output.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_ERROR(dev, fmt, ...)					\
+	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
+		       fmt, ##__VA_ARGS__)
+#define DRM_ERROR(fmt, ...)						\
+	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
+
+/**
+ * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
+({									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+									\
+	if (__ratelimit(&_rs))						\
+		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
+})
+#define DRM_ERROR_RATELIMITED(fmt, ...)					\
+	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_INFO(dev, fmt, ...)					\
+	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
+		       ##__VA_ARGS__)
+
+#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
+({									\
+	static bool __print_once __read_mostly;				\
+	if (!__print_once) {						\
+		__print_once = true;					\
+		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
+	}								\
+})
+
+/**
+ * Debug output.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_DEBUG(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
+		       ##args)
+#define DRM_DEBUG(fmt, ...)						\
+	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
+		       fmt, ##args)
+#define DRM_DEBUG_DRIVER(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
+		       ##args)
+#define DRM_DEBUG_KMS(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
+		       fmt, ##args)
+#define DRM_DEBUG_PRIME(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
+		       fmt, ##args)
+#define DRM_DEBUG_ATOMIC(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
+		       ##args)
+#define DRM_DEBUG_VBL(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
+
+#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
+({									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
+			       __func__, "", fmt, ##args);		\
+})
+
+/**
+ * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
+	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
+#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
+	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
+#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
+	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
+#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
+	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
+#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
+	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
+#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
+	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
+#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
+	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
+#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
+	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
+
+/* Format strings and argument splitters to simplify printing
+ * various "complex" objects
+ */
+
+/*@}*/
+
+#endif /* _DRM_DEBUG_H_ */
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 71bbaae..4f3cc25 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -592,13 +592,6 @@ struct drm_driver {
 	int dev_priv_size;
 };
 
-__printf(6, 7)
-void drm_dev_printk(const struct device *dev, const char *level,
-		    unsigned int category, const char *function_name,
-		    const char *prefix, const char *format, ...);
-__printf(3, 4)
-void drm_printk(const char *level, unsigned int category,
-		const char *format, ...);
 extern unsigned int drm_debug;
 
 int drm_dev_init(struct drm_device *dev,
-- 
2.7.4



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

* [PATCH 1/2] drm: Extract drm_debug.[hc]
@ 2017-10-11  4:13   ` Haneen Mohammed
  0 siblings, 0 replies; 16+ messages in thread
From: Haneen Mohammed @ 2017-10-11  4:13 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, gregkh, outreachy-kernel

Extract DRM_* debug macros from drmP.h to drm_debug.h and move printting
related functions from drm_drv.[hc] to drm_debug.[hc].

Update kerneldoc include directives accordingly.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
 Documentation/gpu/drm-uapi.rst |   9 ++
 drivers/gpu/drm/Makefile       |   2 +-
 drivers/gpu/drm/drm_debug.c    |  75 ++++++++++++++++
 drivers/gpu/drm/drm_drv.c      |  47 ----------
 include/drm/drmP.h             | 149 +------------------------------
 include/drm/drm_debug.h        | 193 +++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_drv.h          |   7 --
 7 files changed, 279 insertions(+), 203 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_debug.c
 create mode 100644 include/drm/drm_debug.h

diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
index 679373b..9a374e6 100644
--- a/Documentation/gpu/drm-uapi.rst
+++ b/Documentation/gpu/drm-uapi.rst
@@ -235,6 +235,15 @@ Debugfs Support
 .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c
    :export:
 
+Debug Support
+-------------
+
+.. kernel-doc:: include/drm/drm_debug.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/drm_debug.c
+   :export:
+
 Sysfs Support
 =============
 
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index a8acc19..d09bd06 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -3,7 +3,7 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
-		drm_context.o drm_dma.o \
+		drm_context.o drm_dma.o drm_debug.o \
 		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
 		drm_lock.o drm_memory.o drm_drv.o \
 		drm_scatter.o drm_pci.o \
diff --git a/drivers/gpu/drm/drm_debug.c b/drivers/gpu/drm/drm_debug.c
new file mode 100644
index 0000000..a79593f
--- /dev/null
+++ b/drivers/gpu/drm/drm_debug.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Author Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <drm/drm_debug.h>
+#include <drm/drmP.h>
+
+#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
+
+void drm_dev_printk(const struct device *dev, const char *level,
+		    unsigned int category, const char *function_name,
+		    const char *prefix, const char *format, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	if (category != DRM_UT_NONE && !(drm_debug & category))
+		return;
+
+	va_start(args, format);
+	vaf.fmt = format;
+	vaf.va = &args;
+
+	if (dev)
+		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
+			   &vaf);
+	else
+		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
+
+	va_end(args);
+}
+EXPORT_SYMBOL(drm_dev_printk);
+
+void drm_printk(const char *level, unsigned int category,
+		const char *format, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	if (category != DRM_UT_NONE && !(drm_debug & category))
+		return;
+
+	va_start(args, format);
+	vaf.fmt = format;
+	vaf.va = &args;
+
+	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
+	       level, __builtin_return_address(0),
+	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
+
+	va_end(args);
+}
+EXPORT_SYMBOL(drm_printk);
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index be38ac7..9710c78 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -74,53 +74,6 @@ static bool drm_core_init_complete = false;
 
 static struct dentry *drm_debugfs_root;
 
-#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
-
-void drm_dev_printk(const struct device *dev, const char *level,
-		    unsigned int category, const char *function_name,
-		    const char *prefix, const char *format, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	if (category != DRM_UT_NONE && !(drm_debug & category))
-		return;
-
-	va_start(args, format);
-	vaf.fmt = format;
-	vaf.va = &args;
-
-	if (dev)
-		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
-			   &vaf);
-	else
-		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(drm_dev_printk);
-
-void drm_printk(const char *level, unsigned int category,
-		const char *format, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	if (category != DRM_UT_NONE && !(drm_debug & category))
-		return;
-
-	va_start(args, format);
-	vaf.fmt = format;
-	vaf.va = &args;
-
-	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
-	       level, __builtin_return_address(0),
-	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(drm_printk);
-
 /*
  * DRM Minors
  * A DRM device can provide several char-dev interfaces on the DRM-Major. Each
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7277783a..8186a96 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -77,6 +77,7 @@
 #include <drm/drm_prime.h>
 #include <drm/drm_pci.h>
 #include <drm/drm_file.h>
+#include <drm/drm_debug.h>
 #include <drm/drm_debugfs.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_sysfs.h>
@@ -142,154 +143,6 @@ struct pci_controller;
 /*@{*/
 
 /***********************************************************************/
-/** \name Macros to make printk easier */
-/*@{*/
-
-#define _DRM_PRINTK(once, level, fmt, ...)				\
-	do {								\
-		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
-			     ##__VA_ARGS__);				\
-	} while (0)
-
-#define DRM_INFO(fmt, ...)						\
-	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
-#define DRM_NOTE(fmt, ...)						\
-	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
-#define DRM_WARN(fmt, ...)						\
-	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
-
-#define DRM_INFO_ONCE(fmt, ...)						\
-	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
-#define DRM_NOTE_ONCE(fmt, ...)						\
-	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
-#define DRM_WARN_ONCE(fmt, ...)						\
-	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
-
-/**
- * Error output.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_ERROR(dev, fmt, ...)					\
-	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
-		       fmt, ##__VA_ARGS__)
-#define DRM_ERROR(fmt, ...)						\
-	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
-
-/**
- * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
-({									\
-	static DEFINE_RATELIMIT_STATE(_rs,				\
-				      DEFAULT_RATELIMIT_INTERVAL,	\
-				      DEFAULT_RATELIMIT_BURST);		\
-									\
-	if (__ratelimit(&_rs))						\
-		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
-})
-#define DRM_ERROR_RATELIMITED(fmt, ...)					\
-	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_INFO(dev, fmt, ...)					\
-	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
-		       ##__VA_ARGS__)
-
-#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
-({									\
-	static bool __print_once __read_mostly;				\
-	if (!__print_once) {						\
-		__print_once = true;					\
-		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
-	}								\
-})
-
-/**
- * Debug output.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_DEBUG(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
-		       ##args)
-#define DRM_DEBUG(fmt, ...)						\
-	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
-		       fmt, ##args)
-#define DRM_DEBUG_DRIVER(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
-		       ##args)
-#define DRM_DEBUG_KMS(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
-		       fmt, ##args)
-#define DRM_DEBUG_PRIME(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
-		       fmt, ##args)
-#define DRM_DEBUG_ATOMIC(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
-
-#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
-		       ##args)
-#define DRM_DEBUG_VBL(fmt, ...)					\
-	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
-
-#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
-({									\
-	static DEFINE_RATELIMIT_STATE(_rs,				\
-				      DEFAULT_RATELIMIT_INTERVAL,	\
-				      DEFAULT_RATELIMIT_BURST);		\
-	if (__ratelimit(&_rs))						\
-		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
-			       __func__, "", fmt, ##args);		\
-})
-
-/**
- * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
-	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
-#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
-	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
-#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
-#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
-	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
-#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
-#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
-	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
-#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
-#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
-	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
-
-/* Format strings and argument splitters to simplify printing
- * various "complex" objects
- */
-
-/*@}*/
-
-/***********************************************************************/
 /** \name Internal types and structures */
 /*@{*/
 
diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
new file mode 100644
index 0000000..24fbea4
--- /dev/null
+++ b/include/drm/drm_debug.h
@@ -0,0 +1,193 @@
+/*
+ * Internal Header for the Direct Rendering Manager
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * Copyright (c) 2009-2010, Code Aurora Forum.
+ * All rights reserved.
+ *
+ * Author: Rickard E. (Rik) Faith <faith@valinux.com>
+ * Author: Gareth Hughes <gareth@valinux.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _DRM_DEBUG_H_
+#define _DRM_DEBUG_H_
+
+#include <linux/kernel.h>
+
+__printf(6, 7)
+void drm_dev_printk(const struct device *dev, const char *level,
+		    unsigned int category, const char *function_name,
+		    const char *prefix, const char *format, ...);
+__printf(3, 4)
+void drm_printk(const char *level, unsigned int category,
+		const char *format, ...);
+
+/***********************************************************************/
+/** \name Macros to make printk easier */
+/*@{*/
+
+#define _DRM_PRINTK(once, level, fmt, ...)				\
+	do {								\
+		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
+			     ##__VA_ARGS__);				\
+	} while (0)
+
+#define DRM_INFO(fmt, ...)						\
+	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
+#define DRM_NOTE(fmt, ...)						\
+	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
+#define DRM_WARN(fmt, ...)						\
+	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
+
+#define DRM_INFO_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
+#define DRM_NOTE_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
+#define DRM_WARN_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
+
+/**
+ * Error output.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_ERROR(dev, fmt, ...)					\
+	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
+		       fmt, ##__VA_ARGS__)
+#define DRM_ERROR(fmt, ...)						\
+	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
+
+/**
+ * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
+({									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+									\
+	if (__ratelimit(&_rs))						\
+		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
+})
+#define DRM_ERROR_RATELIMITED(fmt, ...)					\
+	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_INFO(dev, fmt, ...)					\
+	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
+		       ##__VA_ARGS__)
+
+#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
+({									\
+	static bool __print_once __read_mostly;				\
+	if (!__print_once) {						\
+		__print_once = true;					\
+		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
+	}								\
+})
+
+/**
+ * Debug output.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_DEBUG(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
+		       ##args)
+#define DRM_DEBUG(fmt, ...)						\
+	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
+		       fmt, ##args)
+#define DRM_DEBUG_DRIVER(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
+		       ##args)
+#define DRM_DEBUG_KMS(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
+		       fmt, ##args)
+#define DRM_DEBUG_PRIME(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
+		       fmt, ##args)
+#define DRM_DEBUG_ATOMIC(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
+
+#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
+		       ##args)
+#define DRM_DEBUG_VBL(fmt, ...)					\
+	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
+
+#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
+({									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
+			       __func__, "", fmt, ##args);		\
+})
+
+/**
+ * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
+	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
+#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
+	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
+#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
+	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
+#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
+	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
+#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
+	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
+#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
+	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
+#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
+	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
+#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
+	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
+
+/* Format strings and argument splitters to simplify printing
+ * various "complex" objects
+ */
+
+/*@}*/
+
+#endif /* _DRM_DEBUG_H_ */
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 71bbaae..4f3cc25 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -592,13 +592,6 @@ struct drm_driver {
 	int dev_priv_size;
 };
 
-__printf(6, 7)
-void drm_dev_printk(const struct device *dev, const char *level,
-		    unsigned int category, const char *function_name,
-		    const char *prefix, const char *format, ...);
-__printf(3, 4)
-void drm_printk(const char *level, unsigned int category,
-		const char *format, ...);
 extern unsigned int drm_debug;
 
 int drm_dev_init(struct drm_device *dev,
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 2/2] drm: Update old comment style
       [not found] <cover.1507693829.git.hamohammed.sa@gmail.com>
@ 2017-10-11  4:16   ` Haneen Mohammed
  2017-10-11  4:16   ` Haneen Mohammed
  1 sibling, 0 replies; 16+ messages in thread
From: Haneen Mohammed @ 2017-10-11  4:16 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, gregkh, outreachy-kernel, David Airlie

Remove old comment style used by doxygen.
And remove comment left from commit 99cdb35e787b ("drm/doc: move printf
helpers out of drmP.h") after refactoring drmP.h.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
 include/drm/drm_debug.h | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
index 24fbea4..78e3702 100644
--- a/include/drm/drm_debug.h
+++ b/include/drm/drm_debug.h
@@ -42,9 +42,7 @@ __printf(3, 4)
 void drm_printk(const char *level, unsigned int category,
 		const char *format, ...);
 
-/***********************************************************************/
-/** \name Macros to make printk easier */
-/*@{*/
+/** Macros to make printk easier */
 
 #define _DRM_PRINTK(once, level, fmt, ...)				\
 	do {								\
@@ -69,8 +67,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Error output.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_ERROR(dev, fmt, ...)					\
 	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
@@ -81,8 +79,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
 ({									\
@@ -112,8 +110,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Debug output.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_DEBUG(dev, fmt, args...)				\
 	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
@@ -164,8 +162,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
 	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
@@ -184,10 +182,4 @@ void drm_printk(const char *level, unsigned int category,
 #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
 	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
 
-/* Format strings and argument splitters to simplify printing
- * various "complex" objects
- */
-
-/*@}*/
-
 #endif /* _DRM_DEBUG_H_ */
-- 
2.7.4



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

* [PATCH 2/2] drm: Update old comment style
@ 2017-10-11  4:16   ` Haneen Mohammed
  0 siblings, 0 replies; 16+ messages in thread
From: Haneen Mohammed @ 2017-10-11  4:16 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, outreachy-kernel, gregkh

Remove old comment style used by doxygen.
And remove comment left from commit 99cdb35e787b ("drm/doc: move printf
helpers out of drmP.h") after refactoring drmP.h.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
 include/drm/drm_debug.h | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
index 24fbea4..78e3702 100644
--- a/include/drm/drm_debug.h
+++ b/include/drm/drm_debug.h
@@ -42,9 +42,7 @@ __printf(3, 4)
 void drm_printk(const char *level, unsigned int category,
 		const char *format, ...);
 
-/***********************************************************************/
-/** \name Macros to make printk easier */
-/*@{*/
+/** Macros to make printk easier */
 
 #define _DRM_PRINTK(once, level, fmt, ...)				\
 	do {								\
@@ -69,8 +67,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Error output.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_ERROR(dev, fmt, ...)					\
 	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
@@ -81,8 +79,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
 ({									\
@@ -112,8 +110,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Debug output.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_DEBUG(dev, fmt, args...)				\
 	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
@@ -164,8 +162,8 @@ void drm_printk(const char *level, unsigned int category,
 /**
  * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
  *
- * \param fmt printf() like format string.
- * \param arg arguments
+ * @fmt: printf() like format string.
+ * @arg: arguments
  */
 #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
 	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
@@ -184,10 +182,4 @@ void drm_printk(const char *level, unsigned int category,
 #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
 	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
 
-/* Format strings and argument splitters to simplify printing
- * various "complex" objects
- */
-
-/*@}*/
-
 #endif /* _DRM_DEBUG_H_ */
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
  2017-10-11  4:13   ` Haneen Mohammed
@ 2017-10-11 10:12     ` Ville Syrjälä
  -1 siblings, 0 replies; 16+ messages in thread
From: Ville Syrjälä @ 2017-10-11 10:12 UTC (permalink / raw)
  To: Haneen Mohammed
  Cc: dri-devel, Daniel Vetter, gregkh, outreachy-kernel, Sean Paul,
	Eric Engestrom

On Tue, Oct 10, 2017 at 10:13:36PM -0600, Haneen Mohammed wrote:
> -/**
> - * Debug output.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> -		       ##args)

BTW if you're poking around these parts maybe you might consider undoing
the damage from c4e68a583202 ("drm: Introduce DRM_DEV_* log messages")
and restoing the 'if (unlikely(drm_debug & DRM_UT_...)' into the debug
macros. Currently we're paying the cost of the function call for every
debug statement even when debugs are disabled.

-- 
Ville Syrj�l�
Intel OTC


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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
@ 2017-10-11 10:12     ` Ville Syrjälä
  0 siblings, 0 replies; 16+ messages in thread
From: Ville Syrjälä @ 2017-10-11 10:12 UTC (permalink / raw)
  To: Haneen Mohammed; +Cc: Daniel Vetter, dri-devel, outreachy-kernel, gregkh

On Tue, Oct 10, 2017 at 10:13:36PM -0600, Haneen Mohammed wrote:
> -/**
> - * Debug output.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> -		       ##args)

BTW if you're poking around these parts maybe you might consider undoing
the damage from c4e68a583202 ("drm: Introduce DRM_DEV_* log messages")
and restoing the 'if (unlikely(drm_debug & DRM_UT_...)' into the debug
macros. Currently we're paying the cost of the function call for every
debug statement even when debugs are disabled.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
  2017-10-11  4:13   ` Haneen Mohammed
@ 2017-10-11 11:40     ` Daniel Vetter
  -1 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2017-10-11 11:40 UTC (permalink / raw)
  To: Haneen Mohammed
  Cc: dri-devel, David Airlie, Daniel Vetter, outreachy-kernel, gregkh

On Tue, Oct 10, 2017 at 10:13:36PM -0600, Haneen Mohammed wrote:
> Extract DRM_* debug macros from drmP.h to drm_debug.h and move printting
> related functions from drm_drv.[hc] to drm_debug.[hc].
> 
> Update kerneldoc include directives accordingly.
> 
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> ---
>  Documentation/gpu/drm-uapi.rst |   9 ++
>  drivers/gpu/drm/Makefile       |   2 +-
>  drivers/gpu/drm/drm_debug.c    |  75 ++++++++++++++++
>  drivers/gpu/drm/drm_drv.c      |  47 ----------
>  include/drm/drmP.h             | 149 +------------------------------
>  include/drm/drm_debug.h        | 193 +++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_drv.h          |   7 --
>  7 files changed, 279 insertions(+), 203 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_debug.c
>  create mode 100644 include/drm/drm_debug.h
> 
> diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
> index 679373b..9a374e6 100644
> --- a/Documentation/gpu/drm-uapi.rst
> +++ b/Documentation/gpu/drm-uapi.rst
> @@ -235,6 +235,15 @@ Debugfs Support
>  .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c
>     :export:
>  
> +Debug Support
> +-------------
> +
> +.. kernel-doc:: include/drm/drm_debug.h
> +   :internal:
> +
> +.. kernel-doc:: drivers/gpu/drm/drm_debug.c
> +   :export:

debug output isn't really userspace interfaces. Why did you place it here?

I think finding a suitable place somewhere in drm-internal.rst would be
better.
-Daniel

> +
>  Sysfs Support
>  =============
>  
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index a8acc19..d09bd06 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -3,7 +3,7 @@
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>  
>  drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
> -		drm_context.o drm_dma.o \
> +		drm_context.o drm_dma.o drm_debug.o \
>  		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
>  		drm_lock.o drm_memory.o drm_drv.o \
>  		drm_scatter.o drm_pci.o \
> diff --git a/drivers/gpu/drm/drm_debug.c b/drivers/gpu/drm/drm_debug.c
> new file mode 100644
> index 0000000..a79593f
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_debug.c
> @@ -0,0 +1,75 @@
> +/*
> + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
> + * All Rights Reserved.
> + *
> + * Author Rickard E. (Rik) Faith <faith@valinux.com>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +#include <drm/drm_debug.h>
> +#include <drm/drmP.h>
> +
> +#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> +
> +void drm_dev_printk(const struct device *dev, const char *level,
> +		    unsigned int category, const char *function_name,
> +		    const char *prefix, const char *format, ...)
> +{
> +	struct va_format vaf;
> +	va_list args;
> +
> +	if (category != DRM_UT_NONE && !(drm_debug & category))
> +		return;
> +
> +	va_start(args, format);
> +	vaf.fmt = format;
> +	vaf.va = &args;
> +
> +	if (dev)
> +		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> +			   &vaf);
> +	else
> +		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> +
> +	va_end(args);
> +}
> +EXPORT_SYMBOL(drm_dev_printk);
> +
> +void drm_printk(const char *level, unsigned int category,
> +		const char *format, ...)
> +{
> +	struct va_format vaf;
> +	va_list args;
> +
> +	if (category != DRM_UT_NONE && !(drm_debug & category))
> +		return;
> +
> +	va_start(args, format);
> +	vaf.fmt = format;
> +	vaf.va = &args;
> +
> +	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> +	       level, __builtin_return_address(0),
> +	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> +
> +	va_end(args);
> +}
> +EXPORT_SYMBOL(drm_printk);
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index be38ac7..9710c78 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -74,53 +74,6 @@ static bool drm_core_init_complete = false;
>  
>  static struct dentry *drm_debugfs_root;
>  
> -#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> -
> -void drm_dev_printk(const struct device *dev, const char *level,
> -		    unsigned int category, const char *function_name,
> -		    const char *prefix, const char *format, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	if (category != DRM_UT_NONE && !(drm_debug & category))
> -		return;
> -
> -	va_start(args, format);
> -	vaf.fmt = format;
> -	vaf.va = &args;
> -
> -	if (dev)
> -		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> -			   &vaf);
> -	else
> -		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> -
> -	va_end(args);
> -}
> -EXPORT_SYMBOL(drm_dev_printk);
> -
> -void drm_printk(const char *level, unsigned int category,
> -		const char *format, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	if (category != DRM_UT_NONE && !(drm_debug & category))
> -		return;
> -
> -	va_start(args, format);
> -	vaf.fmt = format;
> -	vaf.va = &args;
> -
> -	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> -	       level, __builtin_return_address(0),
> -	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> -
> -	va_end(args);
> -}
> -EXPORT_SYMBOL(drm_printk);
> -
>  /*
>   * DRM Minors
>   * A DRM device can provide several char-dev interfaces on the DRM-Major. Each
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 7277783a..8186a96 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -77,6 +77,7 @@
>  #include <drm/drm_prime.h>
>  #include <drm/drm_pci.h>
>  #include <drm/drm_file.h>
> +#include <drm/drm_debug.h>
>  #include <drm/drm_debugfs.h>
>  #include <drm/drm_ioctl.h>
>  #include <drm/drm_sysfs.h>
> @@ -142,154 +143,6 @@ struct pci_controller;
>  /*@{*/
>  
>  /***********************************************************************/
> -/** \name Macros to make printk easier */
> -/*@{*/
> -
> -#define _DRM_PRINTK(once, level, fmt, ...)				\
> -	do {								\
> -		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> -			     ##__VA_ARGS__);				\
> -	} while (0)
> -
> -#define DRM_INFO(fmt, ...)						\
> -	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE(fmt, ...)						\
> -	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN(fmt, ...)						\
> -	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> -
> -/**
> - * Error output.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_ERROR(dev, fmt, ...)					\
> -	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> -		       fmt, ##__VA_ARGS__)
> -#define DRM_ERROR(fmt, ...)						\
> -	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> -
> -/**
> - * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> -({									\
> -	static DEFINE_RATELIMIT_STATE(_rs,				\
> -				      DEFAULT_RATELIMIT_INTERVAL,	\
> -				      DEFAULT_RATELIMIT_BURST);		\
> -									\
> -	if (__ratelimit(&_rs))						\
> -		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> -})
> -#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> -	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_INFO(dev, fmt, ...)					\
> -	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> -		       ##__VA_ARGS__)
> -
> -#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> -({									\
> -	static bool __print_once __read_mostly;				\
> -	if (!__print_once) {						\
> -		__print_once = true;					\
> -		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> -	}								\
> -})
> -
> -/**
> - * Debug output.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> -		       ##args)
> -#define DRM_DEBUG(fmt, ...)						\
> -	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> -		       fmt, ##args)
> -#define DRM_DEBUG_DRIVER(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> -		       ##args)
> -#define DRM_DEBUG_KMS(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> -		       fmt, ##args)
> -#define DRM_DEBUG_PRIME(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> -		       fmt, ##args)
> -#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> -		       ##args)
> -#define DRM_DEBUG_VBL(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> -
> -#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> -({									\
> -	static DEFINE_RATELIMIT_STATE(_rs,				\
> -				      DEFAULT_RATELIMIT_INTERVAL,	\
> -				      DEFAULT_RATELIMIT_BURST);		\
> -	if (__ratelimit(&_rs))						\
> -		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> -			       __func__, "", fmt, ##args);		\
> -})
> -
> -/**
> - * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> -	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> -#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> -	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> -#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> -#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> -	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> -#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> -#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> -	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> -#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> -	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> -
> -/* Format strings and argument splitters to simplify printing
> - * various "complex" objects
> - */
> -
> -/*@}*/
> -
> -/***********************************************************************/
>  /** \name Internal types and structures */
>  /*@{*/
>  
> diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
> new file mode 100644
> index 0000000..24fbea4
> --- /dev/null
> +++ b/include/drm/drm_debug.h
> @@ -0,0 +1,193 @@
> +/*
> + * Internal Header for the Direct Rendering Manager
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
> + * Copyright (c) 2009-2010, Code Aurora Forum.
> + * All rights reserved.
> + *
> + * Author: Rickard E. (Rik) Faith <faith@valinux.com>
> + * Author: Gareth Hughes <gareth@valinux.com>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +#ifndef _DRM_DEBUG_H_
> +#define _DRM_DEBUG_H_
> +
> +#include <linux/kernel.h>
> +
> +__printf(6, 7)
> +void drm_dev_printk(const struct device *dev, const char *level,
> +		    unsigned int category, const char *function_name,
> +		    const char *prefix, const char *format, ...);
> +__printf(3, 4)
> +void drm_printk(const char *level, unsigned int category,
> +		const char *format, ...);
> +
> +/***********************************************************************/
> +/** \name Macros to make printk easier */
> +/*@{*/
> +
> +#define _DRM_PRINTK(once, level, fmt, ...)				\
> +	do {								\
> +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> +			     ##__VA_ARGS__);				\
> +	} while (0)
> +
> +#define DRM_INFO(fmt, ...)						\
> +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE(fmt, ...)						\
> +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN(fmt, ...)						\
> +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> +
> +#define DRM_INFO_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> +
> +/**
> + * Error output.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_ERROR(dev, fmt, ...)					\
> +	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> +		       fmt, ##__VA_ARGS__)
> +#define DRM_ERROR(fmt, ...)						\
> +	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> +
> +/**
> + * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> +({									\
> +	static DEFINE_RATELIMIT_STATE(_rs,				\
> +				      DEFAULT_RATELIMIT_INTERVAL,	\
> +				      DEFAULT_RATELIMIT_BURST);		\
> +									\
> +	if (__ratelimit(&_rs))						\
> +		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> +})
> +#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> +	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_INFO(dev, fmt, ...)					\
> +	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> +		       ##__VA_ARGS__)
> +
> +#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> +({									\
> +	static bool __print_once __read_mostly;				\
> +	if (!__print_once) {						\
> +		__print_once = true;					\
> +		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> +	}								\
> +})
> +
> +/**
> + * Debug output.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> +		       ##args)
> +#define DRM_DEBUG(fmt, ...)						\
> +	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> +		       fmt, ##args)
> +#define DRM_DEBUG_DRIVER(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> +		       ##args)
> +#define DRM_DEBUG_KMS(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> +		       fmt, ##args)
> +#define DRM_DEBUG_PRIME(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> +		       fmt, ##args)
> +#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> +		       ##args)
> +#define DRM_DEBUG_VBL(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> +
> +#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> +({									\
> +	static DEFINE_RATELIMIT_STATE(_rs,				\
> +				      DEFAULT_RATELIMIT_INTERVAL,	\
> +				      DEFAULT_RATELIMIT_BURST);		\
> +	if (__ratelimit(&_rs))						\
> +		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> +			       __func__, "", fmt, ##args);		\
> +})
> +
> +/**
> + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> +	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> +#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> +	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> +#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> +	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> +#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> +	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> +#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> +	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> +
> +/* Format strings and argument splitters to simplify printing
> + * various "complex" objects
> + */
> +
> +/*@}*/
> +
> +#endif /* _DRM_DEBUG_H_ */
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 71bbaae..4f3cc25 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -592,13 +592,6 @@ struct drm_driver {
>  	int dev_priv_size;
>  };
>  
> -__printf(6, 7)
> -void drm_dev_printk(const struct device *dev, const char *level,
> -		    unsigned int category, const char *function_name,
> -		    const char *prefix, const char *format, ...);
> -__printf(3, 4)
> -void drm_printk(const char *level, unsigned int category,
> -		const char *format, ...);
>  extern unsigned int drm_debug;
>  
>  int drm_dev_init(struct drm_device *dev,
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
@ 2017-10-11 11:40     ` Daniel Vetter
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2017-10-11 11:40 UTC (permalink / raw)
  To: Haneen Mohammed; +Cc: Daniel Vetter, gregkh, dri-devel, outreachy-kernel

On Tue, Oct 10, 2017 at 10:13:36PM -0600, Haneen Mohammed wrote:
> Extract DRM_* debug macros from drmP.h to drm_debug.h and move printting
> related functions from drm_drv.[hc] to drm_debug.[hc].
> 
> Update kerneldoc include directives accordingly.
> 
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> ---
>  Documentation/gpu/drm-uapi.rst |   9 ++
>  drivers/gpu/drm/Makefile       |   2 +-
>  drivers/gpu/drm/drm_debug.c    |  75 ++++++++++++++++
>  drivers/gpu/drm/drm_drv.c      |  47 ----------
>  include/drm/drmP.h             | 149 +------------------------------
>  include/drm/drm_debug.h        | 193 +++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_drv.h          |   7 --
>  7 files changed, 279 insertions(+), 203 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_debug.c
>  create mode 100644 include/drm/drm_debug.h
> 
> diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
> index 679373b..9a374e6 100644
> --- a/Documentation/gpu/drm-uapi.rst
> +++ b/Documentation/gpu/drm-uapi.rst
> @@ -235,6 +235,15 @@ Debugfs Support
>  .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c
>     :export:
>  
> +Debug Support
> +-------------
> +
> +.. kernel-doc:: include/drm/drm_debug.h
> +   :internal:
> +
> +.. kernel-doc:: drivers/gpu/drm/drm_debug.c
> +   :export:

debug output isn't really userspace interfaces. Why did you place it here?

I think finding a suitable place somewhere in drm-internal.rst would be
better.
-Daniel

> +
>  Sysfs Support
>  =============
>  
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index a8acc19..d09bd06 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -3,7 +3,7 @@
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>  
>  drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
> -		drm_context.o drm_dma.o \
> +		drm_context.o drm_dma.o drm_debug.o \
>  		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
>  		drm_lock.o drm_memory.o drm_drv.o \
>  		drm_scatter.o drm_pci.o \
> diff --git a/drivers/gpu/drm/drm_debug.c b/drivers/gpu/drm/drm_debug.c
> new file mode 100644
> index 0000000..a79593f
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_debug.c
> @@ -0,0 +1,75 @@
> +/*
> + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
> + * All Rights Reserved.
> + *
> + * Author Rickard E. (Rik) Faith <faith@valinux.com>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +#include <drm/drm_debug.h>
> +#include <drm/drmP.h>
> +
> +#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> +
> +void drm_dev_printk(const struct device *dev, const char *level,
> +		    unsigned int category, const char *function_name,
> +		    const char *prefix, const char *format, ...)
> +{
> +	struct va_format vaf;
> +	va_list args;
> +
> +	if (category != DRM_UT_NONE && !(drm_debug & category))
> +		return;
> +
> +	va_start(args, format);
> +	vaf.fmt = format;
> +	vaf.va = &args;
> +
> +	if (dev)
> +		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> +			   &vaf);
> +	else
> +		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> +
> +	va_end(args);
> +}
> +EXPORT_SYMBOL(drm_dev_printk);
> +
> +void drm_printk(const char *level, unsigned int category,
> +		const char *format, ...)
> +{
> +	struct va_format vaf;
> +	va_list args;
> +
> +	if (category != DRM_UT_NONE && !(drm_debug & category))
> +		return;
> +
> +	va_start(args, format);
> +	vaf.fmt = format;
> +	vaf.va = &args;
> +
> +	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> +	       level, __builtin_return_address(0),
> +	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> +
> +	va_end(args);
> +}
> +EXPORT_SYMBOL(drm_printk);
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index be38ac7..9710c78 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -74,53 +74,6 @@ static bool drm_core_init_complete = false;
>  
>  static struct dentry *drm_debugfs_root;
>  
> -#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> -
> -void drm_dev_printk(const struct device *dev, const char *level,
> -		    unsigned int category, const char *function_name,
> -		    const char *prefix, const char *format, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	if (category != DRM_UT_NONE && !(drm_debug & category))
> -		return;
> -
> -	va_start(args, format);
> -	vaf.fmt = format;
> -	vaf.va = &args;
> -
> -	if (dev)
> -		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> -			   &vaf);
> -	else
> -		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> -
> -	va_end(args);
> -}
> -EXPORT_SYMBOL(drm_dev_printk);
> -
> -void drm_printk(const char *level, unsigned int category,
> -		const char *format, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	if (category != DRM_UT_NONE && !(drm_debug & category))
> -		return;
> -
> -	va_start(args, format);
> -	vaf.fmt = format;
> -	vaf.va = &args;
> -
> -	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> -	       level, __builtin_return_address(0),
> -	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> -
> -	va_end(args);
> -}
> -EXPORT_SYMBOL(drm_printk);
> -
>  /*
>   * DRM Minors
>   * A DRM device can provide several char-dev interfaces on the DRM-Major. Each
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 7277783a..8186a96 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -77,6 +77,7 @@
>  #include <drm/drm_prime.h>
>  #include <drm/drm_pci.h>
>  #include <drm/drm_file.h>
> +#include <drm/drm_debug.h>
>  #include <drm/drm_debugfs.h>
>  #include <drm/drm_ioctl.h>
>  #include <drm/drm_sysfs.h>
> @@ -142,154 +143,6 @@ struct pci_controller;
>  /*@{*/
>  
>  /***********************************************************************/
> -/** \name Macros to make printk easier */
> -/*@{*/
> -
> -#define _DRM_PRINTK(once, level, fmt, ...)				\
> -	do {								\
> -		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> -			     ##__VA_ARGS__);				\
> -	} while (0)
> -
> -#define DRM_INFO(fmt, ...)						\
> -	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE(fmt, ...)						\
> -	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN(fmt, ...)						\
> -	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> -
> -/**
> - * Error output.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_ERROR(dev, fmt, ...)					\
> -	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> -		       fmt, ##__VA_ARGS__)
> -#define DRM_ERROR(fmt, ...)						\
> -	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> -
> -/**
> - * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> -({									\
> -	static DEFINE_RATELIMIT_STATE(_rs,				\
> -				      DEFAULT_RATELIMIT_INTERVAL,	\
> -				      DEFAULT_RATELIMIT_BURST);		\
> -									\
> -	if (__ratelimit(&_rs))						\
> -		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> -})
> -#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> -	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_INFO(dev, fmt, ...)					\
> -	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> -		       ##__VA_ARGS__)
> -
> -#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> -({									\
> -	static bool __print_once __read_mostly;				\
> -	if (!__print_once) {						\
> -		__print_once = true;					\
> -		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> -	}								\
> -})
> -
> -/**
> - * Debug output.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> -		       ##args)
> -#define DRM_DEBUG(fmt, ...)						\
> -	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> -		       fmt, ##args)
> -#define DRM_DEBUG_DRIVER(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> -		       ##args)
> -#define DRM_DEBUG_KMS(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> -		       fmt, ##args)
> -#define DRM_DEBUG_PRIME(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> -		       fmt, ##args)
> -#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> -		       ##args)
> -#define DRM_DEBUG_VBL(fmt, ...)					\
> -	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> -
> -#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> -({									\
> -	static DEFINE_RATELIMIT_STATE(_rs,				\
> -				      DEFAULT_RATELIMIT_INTERVAL,	\
> -				      DEFAULT_RATELIMIT_BURST);		\
> -	if (__ratelimit(&_rs))						\
> -		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> -			       __func__, "", fmt, ##args);		\
> -})
> -
> -/**
> - * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> - *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> - */
> -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> -	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> -#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> -	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> -#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> -#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> -	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> -#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> -#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> -	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> -#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> -	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> -
> -/* Format strings and argument splitters to simplify printing
> - * various "complex" objects
> - */
> -
> -/*@}*/
> -
> -/***********************************************************************/
>  /** \name Internal types and structures */
>  /*@{*/
>  
> diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
> new file mode 100644
> index 0000000..24fbea4
> --- /dev/null
> +++ b/include/drm/drm_debug.h
> @@ -0,0 +1,193 @@
> +/*
> + * Internal Header for the Direct Rendering Manager
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
> + * Copyright (c) 2009-2010, Code Aurora Forum.
> + * All rights reserved.
> + *
> + * Author: Rickard E. (Rik) Faith <faith@valinux.com>
> + * Author: Gareth Hughes <gareth@valinux.com>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +#ifndef _DRM_DEBUG_H_
> +#define _DRM_DEBUG_H_
> +
> +#include <linux/kernel.h>
> +
> +__printf(6, 7)
> +void drm_dev_printk(const struct device *dev, const char *level,
> +		    unsigned int category, const char *function_name,
> +		    const char *prefix, const char *format, ...);
> +__printf(3, 4)
> +void drm_printk(const char *level, unsigned int category,
> +		const char *format, ...);
> +
> +/***********************************************************************/
> +/** \name Macros to make printk easier */
> +/*@{*/
> +
> +#define _DRM_PRINTK(once, level, fmt, ...)				\
> +	do {								\
> +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> +			     ##__VA_ARGS__);				\
> +	} while (0)
> +
> +#define DRM_INFO(fmt, ...)						\
> +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE(fmt, ...)						\
> +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN(fmt, ...)						\
> +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> +
> +#define DRM_INFO_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> +
> +/**
> + * Error output.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_ERROR(dev, fmt, ...)					\
> +	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> +		       fmt, ##__VA_ARGS__)
> +#define DRM_ERROR(fmt, ...)						\
> +	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> +
> +/**
> + * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> +({									\
> +	static DEFINE_RATELIMIT_STATE(_rs,				\
> +				      DEFAULT_RATELIMIT_INTERVAL,	\
> +				      DEFAULT_RATELIMIT_BURST);		\
> +									\
> +	if (__ratelimit(&_rs))						\
> +		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> +})
> +#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> +	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_INFO(dev, fmt, ...)					\
> +	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> +		       ##__VA_ARGS__)
> +
> +#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> +({									\
> +	static bool __print_once __read_mostly;				\
> +	if (!__print_once) {						\
> +		__print_once = true;					\
> +		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> +	}								\
> +})
> +
> +/**
> + * Debug output.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> +		       ##args)
> +#define DRM_DEBUG(fmt, ...)						\
> +	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> +		       fmt, ##args)
> +#define DRM_DEBUG_DRIVER(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> +		       ##args)
> +#define DRM_DEBUG_KMS(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> +		       fmt, ##args)
> +#define DRM_DEBUG_PRIME(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> +		       fmt, ##args)
> +#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> +		       ##args)
> +#define DRM_DEBUG_VBL(fmt, ...)					\
> +	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> +
> +#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> +({									\
> +	static DEFINE_RATELIMIT_STATE(_rs,				\
> +				      DEFAULT_RATELIMIT_INTERVAL,	\
> +				      DEFAULT_RATELIMIT_BURST);		\
> +	if (__ratelimit(&_rs))						\
> +		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> +			       __func__, "", fmt, ##args);		\
> +})
> +
> +/**
> + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> + *
> + * \param fmt printf() like format string.
> + * \param arg arguments
> + */
> +#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> +	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> +#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> +	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> +#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> +	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> +#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> +	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> +#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> +	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> +
> +/* Format strings and argument splitters to simplify printing
> + * various "complex" objects
> + */
> +
> +/*@}*/
> +
> +#endif /* _DRM_DEBUG_H_ */
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 71bbaae..4f3cc25 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -592,13 +592,6 @@ struct drm_driver {
>  	int dev_priv_size;
>  };
>  
> -__printf(6, 7)
> -void drm_dev_printk(const struct device *dev, const char *level,
> -		    unsigned int category, const char *function_name,
> -		    const char *prefix, const char *format, ...);
> -__printf(3, 4)
> -void drm_printk(const char *level, unsigned int category,
> -		const char *format, ...);
>  extern unsigned int drm_debug;
>  
>  int drm_dev_init(struct drm_device *dev,
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 2/2] drm: Update old comment style
  2017-10-11  4:16   ` Haneen Mohammed
@ 2017-10-11 11:42     ` Daniel Vetter
  -1 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2017-10-11 11:42 UTC (permalink / raw)
  To: Haneen Mohammed
  Cc: dri-devel, Daniel Vetter, gregkh, outreachy-kernel, David Airlie

On Tue, Oct 10, 2017 at 10:16:30PM -0600, Haneen Mohammed wrote:
> Remove old comment style used by doxygen.
> And remove comment left from commit 99cdb35e787b ("drm/doc: move printf
> helpers out of drmP.h") after refactoring drmP.h.
> 
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> ---
>  include/drm/drm_debug.h | 26 +++++++++-----------------
>  1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
> index 24fbea4..78e3702 100644
> --- a/include/drm/drm_debug.h
> +++ b/include/drm/drm_debug.h
> @@ -42,9 +42,7 @@ __printf(3, 4)
>  void drm_printk(const char *level, unsigned int category,
>  		const char *format, ...);
>  
> -/***********************************************************************/
> -/** \name Macros to make printk easier */
> -/*@{*/
> +/** Macros to make printk easier */

Did you test this with the kernel-doc build? This should cause tons of
warnings still ...

On top of Ville's suggestion it would be great if we could complete the
kernel-doc work (in follow-up patches), i.e. document all the functions
exported to drivers, plus the various macros. Many are there already, but
only needed to be converted to kernel-doc style, but a few are missing.
-Daniel

>  
>  #define _DRM_PRINTK(once, level, fmt, ...)				\
>  	do {								\
> @@ -69,8 +67,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Error output.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_ERROR(dev, fmt, ...)					\
>  	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> @@ -81,8 +79,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
>  ({									\
> @@ -112,8 +110,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Debug output.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_DEBUG(dev, fmt, args...)				\
>  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> @@ -164,8 +162,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
>  	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> @@ -184,10 +182,4 @@ void drm_printk(const char *level, unsigned int category,
>  #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
>  	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
>  
> -/* Format strings and argument splitters to simplify printing
> - * various "complex" objects
> - */
> -
> -/*@}*/
> -
>  #endif /* _DRM_DEBUG_H_ */
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


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

* Re: [PATCH 2/2] drm: Update old comment style
@ 2017-10-11 11:42     ` Daniel Vetter
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2017-10-11 11:42 UTC (permalink / raw)
  To: Haneen Mohammed; +Cc: Daniel Vetter, outreachy-kernel, dri-devel, gregkh

On Tue, Oct 10, 2017 at 10:16:30PM -0600, Haneen Mohammed wrote:
> Remove old comment style used by doxygen.
> And remove comment left from commit 99cdb35e787b ("drm/doc: move printf
> helpers out of drmP.h") after refactoring drmP.h.
> 
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> ---
>  include/drm/drm_debug.h | 26 +++++++++-----------------
>  1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
> index 24fbea4..78e3702 100644
> --- a/include/drm/drm_debug.h
> +++ b/include/drm/drm_debug.h
> @@ -42,9 +42,7 @@ __printf(3, 4)
>  void drm_printk(const char *level, unsigned int category,
>  		const char *format, ...);
>  
> -/***********************************************************************/
> -/** \name Macros to make printk easier */
> -/*@{*/
> +/** Macros to make printk easier */

Did you test this with the kernel-doc build? This should cause tons of
warnings still ...

On top of Ville's suggestion it would be great if we could complete the
kernel-doc work (in follow-up patches), i.e. document all the functions
exported to drivers, plus the various macros. Many are there already, but
only needed to be converted to kernel-doc style, but a few are missing.
-Daniel

>  
>  #define _DRM_PRINTK(once, level, fmt, ...)				\
>  	do {								\
> @@ -69,8 +67,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Error output.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_ERROR(dev, fmt, ...)					\
>  	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> @@ -81,8 +79,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
>  ({									\
> @@ -112,8 +110,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Debug output.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_DEBUG(dev, fmt, args...)				\
>  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> @@ -164,8 +162,8 @@ void drm_printk(const char *level, unsigned int category,
>  /**
>   * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
>   *
> - * \param fmt printf() like format string.
> - * \param arg arguments
> + * @fmt: printf() like format string.
> + * @arg: arguments
>   */
>  #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
>  	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> @@ -184,10 +182,4 @@ void drm_printk(const char *level, unsigned int category,
>  #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
>  	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
>  
> -/* Format strings and argument splitters to simplify printing
> - * various "complex" objects
> - */
> -
> -/*@}*/
> -
>  #endif /* _DRM_DEBUG_H_ */
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
  2017-10-11 11:40     ` Daniel Vetter
@ 2017-10-11 21:55       ` Haneen Mohammed
  -1 siblings, 0 replies; 16+ messages in thread
From: Haneen Mohammed @ 2017-10-11 21:55 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: dri-devel, David Airlie, Daniel Vetter, outreachy-kernel, gregkh

On Wed, Oct 11, 2017 at 01:40:47PM +0200, Daniel Vetter wrote:
> On Tue, Oct 10, 2017 at 10:13:36PM -0600, Haneen Mohammed wrote:
> > Extract DRM_* debug macros from drmP.h to drm_debug.h and move printting
> > related functions from drm_drv.[hc] to drm_debug.[hc].
> > 
> > Update kerneldoc include directives accordingly.
> > 
> > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> > ---
> >  Documentation/gpu/drm-uapi.rst |   9 ++
> >  drivers/gpu/drm/Makefile       |   2 +-
> >  drivers/gpu/drm/drm_debug.c    |  75 ++++++++++++++++
> >  drivers/gpu/drm/drm_drv.c      |  47 ----------
> >  include/drm/drmP.h             | 149 +------------------------------
> >  include/drm/drm_debug.h        | 193 +++++++++++++++++++++++++++++++++++++++++
> >  include/drm/drm_drv.h          |   7 --
> >  7 files changed, 279 insertions(+), 203 deletions(-)
> >  create mode 100644 drivers/gpu/drm/drm_debug.c
> >  create mode 100644 include/drm/drm_debug.h
> > 
> > diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
> > index 679373b..9a374e6 100644
> > --- a/Documentation/gpu/drm-uapi.rst
> > +++ b/Documentation/gpu/drm-uapi.rst
> > @@ -235,6 +235,15 @@ Debugfs Support
> >  .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c
> >     :export:
> >  
> > +Debug Support
> > +-------------
> > +
> > +.. kernel-doc:: include/drm/drm_debug.h
> > +   :internal:
> > +
> > +.. kernel-doc:: drivers/gpu/drm/drm_debug.c
> > +   :export:
> 
> debug output isn't really userspace interfaces. Why did you place it here?
> 
> I think finding a suitable place somewhere in drm-internal.rst would be
> better.
> -Daniel
> 

I wasn't sure where to place it, I've just followed the example of drm_debugfs.[hc].
Sure, will fix that. 

Haneen

> > +
> >  Sysfs Support
> >  =============
> >  
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index a8acc19..d09bd06 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -3,7 +3,7 @@
> >  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
> >  
> >  drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
> > -		drm_context.o drm_dma.o \
> > +		drm_context.o drm_dma.o drm_debug.o \
> >  		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
> >  		drm_lock.o drm_memory.o drm_drv.o \
> >  		drm_scatter.o drm_pci.o \
> > diff --git a/drivers/gpu/drm/drm_debug.c b/drivers/gpu/drm/drm_debug.c
> > new file mode 100644
> > index 0000000..a79593f
> > --- /dev/null
> > +++ b/drivers/gpu/drm/drm_debug.c
> > @@ -0,0 +1,75 @@
> > +/*
> > + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
> > + * All Rights Reserved.
> > + *
> > + * Author Rickard E. (Rik) Faith <faith@valinux.com>
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the "Software"),
> > + * to deal in the Software without restriction, including without limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the next
> > + * paragraph) shall be included in all copies or substantial portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> > + * DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +#include <drm/drm_debug.h>
> > +#include <drm/drmP.h>
> > +
> > +#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> > +
> > +void drm_dev_printk(const struct device *dev, const char *level,
> > +		    unsigned int category, const char *function_name,
> > +		    const char *prefix, const char *format, ...)
> > +{
> > +	struct va_format vaf;
> > +	va_list args;
> > +
> > +	if (category != DRM_UT_NONE && !(drm_debug & category))
> > +		return;
> > +
> > +	va_start(args, format);
> > +	vaf.fmt = format;
> > +	vaf.va = &args;
> > +
> > +	if (dev)
> > +		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> > +			   &vaf);
> > +	else
> > +		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> > +
> > +	va_end(args);
> > +}
> > +EXPORT_SYMBOL(drm_dev_printk);
> > +
> > +void drm_printk(const char *level, unsigned int category,
> > +		const char *format, ...)
> > +{
> > +	struct va_format vaf;
> > +	va_list args;
> > +
> > +	if (category != DRM_UT_NONE && !(drm_debug & category))
> > +		return;
> > +
> > +	va_start(args, format);
> > +	vaf.fmt = format;
> > +	vaf.va = &args;
> > +
> > +	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> > +	       level, __builtin_return_address(0),
> > +	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> > +
> > +	va_end(args);
> > +}
> > +EXPORT_SYMBOL(drm_printk);
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index be38ac7..9710c78 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -74,53 +74,6 @@ static bool drm_core_init_complete = false;
> >  
> >  static struct dentry *drm_debugfs_root;
> >  
> > -#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> > -
> > -void drm_dev_printk(const struct device *dev, const char *level,
> > -		    unsigned int category, const char *function_name,
> > -		    const char *prefix, const char *format, ...)
> > -{
> > -	struct va_format vaf;
> > -	va_list args;
> > -
> > -	if (category != DRM_UT_NONE && !(drm_debug & category))
> > -		return;
> > -
> > -	va_start(args, format);
> > -	vaf.fmt = format;
> > -	vaf.va = &args;
> > -
> > -	if (dev)
> > -		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> > -			   &vaf);
> > -	else
> > -		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> > -
> > -	va_end(args);
> > -}
> > -EXPORT_SYMBOL(drm_dev_printk);
> > -
> > -void drm_printk(const char *level, unsigned int category,
> > -		const char *format, ...)
> > -{
> > -	struct va_format vaf;
> > -	va_list args;
> > -
> > -	if (category != DRM_UT_NONE && !(drm_debug & category))
> > -		return;
> > -
> > -	va_start(args, format);
> > -	vaf.fmt = format;
> > -	vaf.va = &args;
> > -
> > -	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> > -	       level, __builtin_return_address(0),
> > -	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> > -
> > -	va_end(args);
> > -}
> > -EXPORT_SYMBOL(drm_printk);
> > -
> >  /*
> >   * DRM Minors
> >   * A DRM device can provide several char-dev interfaces on the DRM-Major. Each
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 7277783a..8186a96 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -77,6 +77,7 @@
> >  #include <drm/drm_prime.h>
> >  #include <drm/drm_pci.h>
> >  #include <drm/drm_file.h>
> > +#include <drm/drm_debug.h>
> >  #include <drm/drm_debugfs.h>
> >  #include <drm/drm_ioctl.h>
> >  #include <drm/drm_sysfs.h>
> > @@ -142,154 +143,6 @@ struct pci_controller;
> >  /*@{*/
> >  
> >  /***********************************************************************/
> > -/** \name Macros to make printk easier */
> > -/*@{*/
> > -
> > -#define _DRM_PRINTK(once, level, fmt, ...)				\
> > -	do {								\
> > -		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > -			     ##__VA_ARGS__);				\
> > -	} while (0)
> > -
> > -#define DRM_INFO(fmt, ...)						\
> > -	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> > -#define DRM_NOTE(fmt, ...)						\
> > -	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> > -#define DRM_WARN(fmt, ...)						\
> > -	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_INFO_ONCE(fmt, ...)						\
> > -	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> > -#define DRM_NOTE_ONCE(fmt, ...)						\
> > -	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> > -#define DRM_WARN_ONCE(fmt, ...)						\
> > -	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> > -
> > -/**
> > - * Error output.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > -	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > -		       fmt, ##__VA_ARGS__)
> > -#define DRM_ERROR(fmt, ...)						\
> > -	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > -
> > -/**
> > - * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -									\
> > -	if (__ratelimit(&_rs))						\
> > -		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> > -})
> > -#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> > -	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_INFO(dev, fmt, ...)					\
> > -	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > -		       ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > -({									\
> > -	static bool __print_once __read_mostly;				\
> > -	if (!__print_once) {						\
> > -		__print_once = true;					\
> > -		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > -	}								\
> > -})
> > -
> > -/**
> > - * Debug output.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG(fmt, ...)						\
> > -	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_KMS(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_PRIME(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_VBL(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > -
> > -#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -	if (__ratelimit(&_rs))						\
> > -		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > -			       __func__, "", fmt, ##args);		\
> > -})
> > -
> > -/**
> > - * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > -	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > -#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > -#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > -#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > -#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > -
> > -/* Format strings and argument splitters to simplify printing
> > - * various "complex" objects
> > - */
> > -
> > -/*@}*/
> > -
> > -/***********************************************************************/
> >  /** \name Internal types and structures */
> >  /*@{*/
> >  
> > diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
> > new file mode 100644
> > index 0000000..24fbea4
> > --- /dev/null
> > +++ b/include/drm/drm_debug.h
> > @@ -0,0 +1,193 @@
> > +/*
> > + * Internal Header for the Direct Rendering Manager
> > + *
> > + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> > + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
> > + * Copyright (c) 2009-2010, Code Aurora Forum.
> > + * All rights reserved.
> > + *
> > + * Author: Rickard E. (Rik) Faith <faith@valinux.com>
> > + * Author: Gareth Hughes <gareth@valinux.com>
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the "Software"),
> > + * to deal in the Software without restriction, including without limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the next
> > + * paragraph) shall be included in all copies or substantial portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > + * OTHER DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +#ifndef _DRM_DEBUG_H_
> > +#define _DRM_DEBUG_H_
> > +
> > +#include <linux/kernel.h>
> > +
> > +__printf(6, 7)
> > +void drm_dev_printk(const struct device *dev, const char *level,
> > +		    unsigned int category, const char *function_name,
> > +		    const char *prefix, const char *format, ...);
> > +__printf(3, 4)
> > +void drm_printk(const char *level, unsigned int category,
> > +		const char *format, ...);
> > +
> > +/***********************************************************************/
> > +/** \name Macros to make printk easier */
> > +/*@{*/
> > +
> > +#define _DRM_PRINTK(once, level, fmt, ...)				\
> > +	do {								\
> > +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > +			     ##__VA_ARGS__);				\
> > +	} while (0)
> > +
> > +#define DRM_INFO(fmt, ...)						\
> > +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> > +#define DRM_NOTE(fmt, ...)						\
> > +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> > +#define DRM_WARN(fmt, ...)						\
> > +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_INFO_ONCE(fmt, ...)						\
> > +	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> > +#define DRM_NOTE_ONCE(fmt, ...)						\
> > +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> > +#define DRM_WARN_ONCE(fmt, ...)						\
> > +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> > +
> > +/**
> > + * Error output.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > +	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > +		       fmt, ##__VA_ARGS__)
> > +#define DRM_ERROR(fmt, ...)						\
> > +	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > +
> > +/**
> > + * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +									\
> > +	if (__ratelimit(&_rs))						\
> > +		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> > +})
> > +#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> > +	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_INFO(dev, fmt, ...)					\
> > +	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > +		       ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > +({									\
> > +	static bool __print_once __read_mostly;				\
> > +	if (!__print_once) {						\
> > +		__print_once = true;					\
> > +		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > +	}								\
> > +})
> > +
> > +/**
> > + * Debug output.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG(fmt, ...)						\
> > +	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_KMS(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_PRIME(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_VBL(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > +
> > +#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +	if (__ratelimit(&_rs))						\
> > +		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > +			       __func__, "", fmt, ##args);		\
> > +})
> > +
> > +/**
> > + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > +	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > +#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > +
> > +/* Format strings and argument splitters to simplify printing
> > + * various "complex" objects
> > + */
> > +
> > +/*@}*/
> > +
> > +#endif /* _DRM_DEBUG_H_ */
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index 71bbaae..4f3cc25 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -592,13 +592,6 @@ struct drm_driver {
> >  	int dev_priv_size;
> >  };
> >  
> > -__printf(6, 7)
> > -void drm_dev_printk(const struct device *dev, const char *level,
> > -		    unsigned int category, const char *function_name,
> > -		    const char *prefix, const char *format, ...);
> > -__printf(3, 4)
> > -void drm_printk(const char *level, unsigned int category,
> > -		const char *format, ...);
> >  extern unsigned int drm_debug;
> >  
> >  int drm_dev_init(struct drm_device *dev,
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
@ 2017-10-11 21:55       ` Haneen Mohammed
  0 siblings, 0 replies; 16+ messages in thread
From: Haneen Mohammed @ 2017-10-11 21:55 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, gregkh, dri-devel, outreachy-kernel

On Wed, Oct 11, 2017 at 01:40:47PM +0200, Daniel Vetter wrote:
> On Tue, Oct 10, 2017 at 10:13:36PM -0600, Haneen Mohammed wrote:
> > Extract DRM_* debug macros from drmP.h to drm_debug.h and move printting
> > related functions from drm_drv.[hc] to drm_debug.[hc].
> > 
> > Update kerneldoc include directives accordingly.
> > 
> > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> > ---
> >  Documentation/gpu/drm-uapi.rst |   9 ++
> >  drivers/gpu/drm/Makefile       |   2 +-
> >  drivers/gpu/drm/drm_debug.c    |  75 ++++++++++++++++
> >  drivers/gpu/drm/drm_drv.c      |  47 ----------
> >  include/drm/drmP.h             | 149 +------------------------------
> >  include/drm/drm_debug.h        | 193 +++++++++++++++++++++++++++++++++++++++++
> >  include/drm/drm_drv.h          |   7 --
> >  7 files changed, 279 insertions(+), 203 deletions(-)
> >  create mode 100644 drivers/gpu/drm/drm_debug.c
> >  create mode 100644 include/drm/drm_debug.h
> > 
> > diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
> > index 679373b..9a374e6 100644
> > --- a/Documentation/gpu/drm-uapi.rst
> > +++ b/Documentation/gpu/drm-uapi.rst
> > @@ -235,6 +235,15 @@ Debugfs Support
> >  .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c
> >     :export:
> >  
> > +Debug Support
> > +-------------
> > +
> > +.. kernel-doc:: include/drm/drm_debug.h
> > +   :internal:
> > +
> > +.. kernel-doc:: drivers/gpu/drm/drm_debug.c
> > +   :export:
> 
> debug output isn't really userspace interfaces. Why did you place it here?
> 
> I think finding a suitable place somewhere in drm-internal.rst would be
> better.
> -Daniel
> 

I wasn't sure where to place it, I've just followed the example of drm_debugfs.[hc].
Sure, will fix that. 

Haneen

> > +
> >  Sysfs Support
> >  =============
> >  
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index a8acc19..d09bd06 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -3,7 +3,7 @@
> >  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
> >  
> >  drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
> > -		drm_context.o drm_dma.o \
> > +		drm_context.o drm_dma.o drm_debug.o \
> >  		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
> >  		drm_lock.o drm_memory.o drm_drv.o \
> >  		drm_scatter.o drm_pci.o \
> > diff --git a/drivers/gpu/drm/drm_debug.c b/drivers/gpu/drm/drm_debug.c
> > new file mode 100644
> > index 0000000..a79593f
> > --- /dev/null
> > +++ b/drivers/gpu/drm/drm_debug.c
> > @@ -0,0 +1,75 @@
> > +/*
> > + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California.
> > + * All Rights Reserved.
> > + *
> > + * Author Rickard E. (Rik) Faith <faith@valinux.com>
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the "Software"),
> > + * to deal in the Software without restriction, including without limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the next
> > + * paragraph) shall be included in all copies or substantial portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> > + * DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +#include <drm/drm_debug.h>
> > +#include <drm/drmP.h>
> > +
> > +#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> > +
> > +void drm_dev_printk(const struct device *dev, const char *level,
> > +		    unsigned int category, const char *function_name,
> > +		    const char *prefix, const char *format, ...)
> > +{
> > +	struct va_format vaf;
> > +	va_list args;
> > +
> > +	if (category != DRM_UT_NONE && !(drm_debug & category))
> > +		return;
> > +
> > +	va_start(args, format);
> > +	vaf.fmt = format;
> > +	vaf.va = &args;
> > +
> > +	if (dev)
> > +		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> > +			   &vaf);
> > +	else
> > +		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> > +
> > +	va_end(args);
> > +}
> > +EXPORT_SYMBOL(drm_dev_printk);
> > +
> > +void drm_printk(const char *level, unsigned int category,
> > +		const char *format, ...)
> > +{
> > +	struct va_format vaf;
> > +	va_list args;
> > +
> > +	if (category != DRM_UT_NONE && !(drm_debug & category))
> > +		return;
> > +
> > +	va_start(args, format);
> > +	vaf.fmt = format;
> > +	vaf.va = &args;
> > +
> > +	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> > +	       level, __builtin_return_address(0),
> > +	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> > +
> > +	va_end(args);
> > +}
> > +EXPORT_SYMBOL(drm_printk);
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index be38ac7..9710c78 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -74,53 +74,6 @@ static bool drm_core_init_complete = false;
> >  
> >  static struct dentry *drm_debugfs_root;
> >  
> > -#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
> > -
> > -void drm_dev_printk(const struct device *dev, const char *level,
> > -		    unsigned int category, const char *function_name,
> > -		    const char *prefix, const char *format, ...)
> > -{
> > -	struct va_format vaf;
> > -	va_list args;
> > -
> > -	if (category != DRM_UT_NONE && !(drm_debug & category))
> > -		return;
> > -
> > -	va_start(args, format);
> > -	vaf.fmt = format;
> > -	vaf.va = &args;
> > -
> > -	if (dev)
> > -		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
> > -			   &vaf);
> > -	else
> > -		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
> > -
> > -	va_end(args);
> > -}
> > -EXPORT_SYMBOL(drm_dev_printk);
> > -
> > -void drm_printk(const char *level, unsigned int category,
> > -		const char *format, ...)
> > -{
> > -	struct va_format vaf;
> > -	va_list args;
> > -
> > -	if (category != DRM_UT_NONE && !(drm_debug & category))
> > -		return;
> > -
> > -	va_start(args, format);
> > -	vaf.fmt = format;
> > -	vaf.va = &args;
> > -
> > -	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
> > -	       level, __builtin_return_address(0),
> > -	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
> > -
> > -	va_end(args);
> > -}
> > -EXPORT_SYMBOL(drm_printk);
> > -
> >  /*
> >   * DRM Minors
> >   * A DRM device can provide several char-dev interfaces on the DRM-Major. Each
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 7277783a..8186a96 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -77,6 +77,7 @@
> >  #include <drm/drm_prime.h>
> >  #include <drm/drm_pci.h>
> >  #include <drm/drm_file.h>
> > +#include <drm/drm_debug.h>
> >  #include <drm/drm_debugfs.h>
> >  #include <drm/drm_ioctl.h>
> >  #include <drm/drm_sysfs.h>
> > @@ -142,154 +143,6 @@ struct pci_controller;
> >  /*@{*/
> >  
> >  /***********************************************************************/
> > -/** \name Macros to make printk easier */
> > -/*@{*/
> > -
> > -#define _DRM_PRINTK(once, level, fmt, ...)				\
> > -	do {								\
> > -		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > -			     ##__VA_ARGS__);				\
> > -	} while (0)
> > -
> > -#define DRM_INFO(fmt, ...)						\
> > -	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> > -#define DRM_NOTE(fmt, ...)						\
> > -	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> > -#define DRM_WARN(fmt, ...)						\
> > -	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_INFO_ONCE(fmt, ...)						\
> > -	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> > -#define DRM_NOTE_ONCE(fmt, ...)						\
> > -	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> > -#define DRM_WARN_ONCE(fmt, ...)						\
> > -	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> > -
> > -/**
> > - * Error output.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > -	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > -		       fmt, ##__VA_ARGS__)
> > -#define DRM_ERROR(fmt, ...)						\
> > -	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > -
> > -/**
> > - * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -									\
> > -	if (__ratelimit(&_rs))						\
> > -		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> > -})
> > -#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> > -	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_INFO(dev, fmt, ...)					\
> > -	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > -		       ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > -({									\
> > -	static bool __print_once __read_mostly;				\
> > -	if (!__print_once) {						\
> > -		__print_once = true;					\
> > -		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > -	}								\
> > -})
> > -
> > -/**
> > - * Debug output.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG(fmt, ...)						\
> > -	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_KMS(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_PRIME(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_VBL(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > -
> > -#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -	if (__ratelimit(&_rs))						\
> > -		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > -			       __func__, "", fmt, ##args);		\
> > -})
> > -
> > -/**
> > - * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > -	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > -#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > -#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > -#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > -#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > -
> > -/* Format strings and argument splitters to simplify printing
> > - * various "complex" objects
> > - */
> > -
> > -/*@}*/
> > -
> > -/***********************************************************************/
> >  /** \name Internal types and structures */
> >  /*@{*/
> >  
> > diff --git a/include/drm/drm_debug.h b/include/drm/drm_debug.h
> > new file mode 100644
> > index 0000000..24fbea4
> > --- /dev/null
> > +++ b/include/drm/drm_debug.h
> > @@ -0,0 +1,193 @@
> > +/*
> > + * Internal Header for the Direct Rendering Manager
> > + *
> > + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> > + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
> > + * Copyright (c) 2009-2010, Code Aurora Forum.
> > + * All rights reserved.
> > + *
> > + * Author: Rickard E. (Rik) Faith <faith@valinux.com>
> > + * Author: Gareth Hughes <gareth@valinux.com>
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the "Software"),
> > + * to deal in the Software without restriction, including without limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the next
> > + * paragraph) shall be included in all copies or substantial portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > + * OTHER DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +#ifndef _DRM_DEBUG_H_
> > +#define _DRM_DEBUG_H_
> > +
> > +#include <linux/kernel.h>
> > +
> > +__printf(6, 7)
> > +void drm_dev_printk(const struct device *dev, const char *level,
> > +		    unsigned int category, const char *function_name,
> > +		    const char *prefix, const char *format, ...);
> > +__printf(3, 4)
> > +void drm_printk(const char *level, unsigned int category,
> > +		const char *format, ...);
> > +
> > +/***********************************************************************/
> > +/** \name Macros to make printk easier */
> > +/*@{*/
> > +
> > +#define _DRM_PRINTK(once, level, fmt, ...)				\
> > +	do {								\
> > +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > +			     ##__VA_ARGS__);				\
> > +	} while (0)
> > +
> > +#define DRM_INFO(fmt, ...)						\
> > +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> > +#define DRM_NOTE(fmt, ...)						\
> > +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> > +#define DRM_WARN(fmt, ...)						\
> > +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_INFO_ONCE(fmt, ...)						\
> > +	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> > +#define DRM_NOTE_ONCE(fmt, ...)						\
> > +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> > +#define DRM_WARN_ONCE(fmt, ...)						\
> > +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> > +
> > +/**
> > + * Error output.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > +	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > +		       fmt, ##__VA_ARGS__)
> > +#define DRM_ERROR(fmt, ...)						\
> > +	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > +
> > +/**
> > + * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +									\
> > +	if (__ratelimit(&_rs))						\
> > +		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
> > +})
> > +#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> > +	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_INFO(dev, fmt, ...)					\
> > +	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > +		       ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > +({									\
> > +	static bool __print_once __read_mostly;				\
> > +	if (!__print_once) {						\
> > +		__print_once = true;					\
> > +		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > +	}								\
> > +})
> > +
> > +/**
> > + * Debug output.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG(fmt, ...)						\
> > +	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_KMS(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_PRIME(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_VBL(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > +
> > +#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +	if (__ratelimit(&_rs))						\
> > +		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > +			       __func__, "", fmt, ##args);		\
> > +})
> > +
> > +/**
> > + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > +	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > +#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > +
> > +/* Format strings and argument splitters to simplify printing
> > + * various "complex" objects
> > + */
> > +
> > +/*@}*/
> > +
> > +#endif /* _DRM_DEBUG_H_ */
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index 71bbaae..4f3cc25 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -592,13 +592,6 @@ struct drm_driver {
> >  	int dev_priv_size;
> >  };
> >  
> > -__printf(6, 7)
> > -void drm_dev_printk(const struct device *dev, const char *level,
> > -		    unsigned int category, const char *function_name,
> > -		    const char *prefix, const char *format, ...);
> > -__printf(3, 4)
> > -void drm_printk(const char *level, unsigned int category,
> > -		const char *format, ...);
> >  extern unsigned int drm_debug;
> >  
> >  int drm_dev_init(struct drm_device *dev,
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
  2017-10-11  4:13   ` Haneen Mohammed
@ 2017-10-12 23:32     ` kbuild test robot
  -1 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2017-10-12 23:32 UTC (permalink / raw)
  To: Haneen Mohammed
  Cc: kbuild-all, dri-devel, Daniel Vetter, gregkh, outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 7107 bytes --]

Hi Haneen,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Extract-drm_debug-hc/20171013-052937
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
   kernel/trace/blktrace.c:824: warning: No description found for parameter 'cgid'
   drivers/gpio/gpiolib.c:593: warning: No description found for parameter '16'
   drivers/gpio/gpiolib.c:593: warning: Excess struct/union/enum/typedef member 'events' description in 'lineevent_state'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'claimed'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'enabled'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_altset_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_stall_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_zlp_not_supp'
   fs/inode.c:1680: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_list'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_type'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits'
   include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no'
   fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_pin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_unpin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_res_obj'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_get_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_import_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vunmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_mmap'
   include/drm/drm_mode_config.h:771: warning: No description found for parameter 'modifiers_property'
   include/drm/drm_mode_config.h:771: warning: Excess struct/union/enum/typedef member 'modifiers' description in 'drm_mode_config'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifiers'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifier_count'
>> include/drm/drm_debug.h:78: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:78: warning: No description found for parameter 'fmt'
   include/drm/drm_debug.h:96: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:96: warning: No description found for parameter 'fmt'
   include/drm/drm_debug.h:121: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:121: warning: No description found for parameter 'fmt'
   include/drm/drm_debug.h:172: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:172: warning: No description found for parameter 'fmt'
>> drivers/gpu/drm/drm_debug.c:1: warning: no structured comments found
   drivers/gpu/host1x/bus.c:50: warning: No description found for parameter 'driver'
   drivers/gpu/drm/tve200/tve200_drv.c:1: warning: no structured comments found
   Documentation/core-api/kernel-api.rst:354: ERROR: Error in "kernel-doc" directive:
   unknown option: "external".

vim +/dev +78 include/drm/drm_debug.h

    48	
    49	#define _DRM_PRINTK(once, level, fmt, ...)				\
    50		do {								\
    51			printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
    52				     ##__VA_ARGS__);				\
    53		} while (0)
    54	
    55	#define DRM_INFO(fmt, ...)						\
    56		_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
    57	#define DRM_NOTE(fmt, ...)						\
    58		_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
    59	#define DRM_WARN(fmt, ...)						\
    60		_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
    61	
    62	#define DRM_INFO_ONCE(fmt, ...)						\
    63		_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
    64	#define DRM_NOTE_ONCE(fmt, ...)						\
    65		_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
    66	#define DRM_WARN_ONCE(fmt, ...)						\
    67		_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
    68	
    69	/**
    70	 * Error output.
    71	 *
    72	 * \param fmt printf() like format string.
    73	 * \param arg arguments
    74	 */
    75	#define DRM_DEV_ERROR(dev, fmt, ...)					\
    76		drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
    77			       fmt, ##__VA_ARGS__)
  > 78	#define DRM_ERROR(fmt, ...)						\
    79		drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
    80	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6771 bytes --]

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

* Re: [PATCH 1/2] drm: Extract drm_debug.[hc]
@ 2017-10-12 23:32     ` kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2017-10-12 23:32 UTC (permalink / raw)
  To: Haneen Mohammed
  Cc: Daniel Vetter, outreachy-kernel, kbuild-all, dri-devel, gregkh

[-- Attachment #1: Type: text/plain, Size: 7107 bytes --]

Hi Haneen,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Extract-drm_debug-hc/20171013-052937
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
   kernel/trace/blktrace.c:824: warning: No description found for parameter 'cgid'
   drivers/gpio/gpiolib.c:593: warning: No description found for parameter '16'
   drivers/gpio/gpiolib.c:593: warning: Excess struct/union/enum/typedef member 'events' description in 'lineevent_state'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'claimed'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'enabled'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_altset_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_stall_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_zlp_not_supp'
   fs/inode.c:1680: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_list'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_type'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits'
   include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no'
   fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_pin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_unpin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_res_obj'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_get_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_import_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vunmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_mmap'
   include/drm/drm_mode_config.h:771: warning: No description found for parameter 'modifiers_property'
   include/drm/drm_mode_config.h:771: warning: Excess struct/union/enum/typedef member 'modifiers' description in 'drm_mode_config'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifiers'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifier_count'
>> include/drm/drm_debug.h:78: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:78: warning: No description found for parameter 'fmt'
   include/drm/drm_debug.h:96: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:96: warning: No description found for parameter 'fmt'
   include/drm/drm_debug.h:121: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:121: warning: No description found for parameter 'fmt'
   include/drm/drm_debug.h:172: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:172: warning: No description found for parameter 'fmt'
>> drivers/gpu/drm/drm_debug.c:1: warning: no structured comments found
   drivers/gpu/host1x/bus.c:50: warning: No description found for parameter 'driver'
   drivers/gpu/drm/tve200/tve200_drv.c:1: warning: no structured comments found
   Documentation/core-api/kernel-api.rst:354: ERROR: Error in "kernel-doc" directive:
   unknown option: "external".

vim +/dev +78 include/drm/drm_debug.h

    48	
    49	#define _DRM_PRINTK(once, level, fmt, ...)				\
    50		do {								\
    51			printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
    52				     ##__VA_ARGS__);				\
    53		} while (0)
    54	
    55	#define DRM_INFO(fmt, ...)						\
    56		_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
    57	#define DRM_NOTE(fmt, ...)						\
    58		_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
    59	#define DRM_WARN(fmt, ...)						\
    60		_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
    61	
    62	#define DRM_INFO_ONCE(fmt, ...)						\
    63		_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
    64	#define DRM_NOTE_ONCE(fmt, ...)						\
    65		_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
    66	#define DRM_WARN_ONCE(fmt, ...)						\
    67		_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
    68	
    69	/**
    70	 * Error output.
    71	 *
    72	 * \param fmt printf() like format string.
    73	 * \param arg arguments
    74	 */
    75	#define DRM_DEV_ERROR(dev, fmt, ...)					\
    76		drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
    77			       fmt, ##__VA_ARGS__)
  > 78	#define DRM_ERROR(fmt, ...)						\
    79		drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
    80	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6771 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 2/2] drm: Update old comment style
  2017-10-11  4:16   ` Haneen Mohammed
@ 2017-10-13  0:40     ` kbuild test robot
  -1 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2017-10-13  0:40 UTC (permalink / raw)
  To: Haneen Mohammed
  Cc: kbuild-all, dri-devel, Daniel Vetter, outreachy-kernel, gregkh

[-- Attachment #1: Type: text/plain, Size: 16767 bytes --]

Hi Haneen,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Extract-drm_debug-hc/20171013-052937
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
   kernel/trace/blktrace.c:824: warning: No description found for parameter 'cgid'
   drivers/gpio/gpiolib.c:593: warning: No description found for parameter '16'
   drivers/gpio/gpiolib.c:593: warning: Excess struct/union/enum/typedef member 'events' description in 'lineevent_state'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'claimed'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'enabled'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_altset_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_stall_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_zlp_not_supp'
   fs/inode.c:1680: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_list'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_type'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits'
   include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no'
   fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_pin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_unpin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_res_obj'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_get_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_import_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vunmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_mmap'
   include/drm/drm_mode_config.h:771: warning: No description found for parameter 'modifiers_property'
   include/drm/drm_mode_config.h:771: warning: Excess struct/union/enum/typedef member 'modifiers' description in 'drm_mode_config'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifiers'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifier_count'
   include/drm/drm_debug.h:76: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:76: warning: Excess function parameter 'arg' description in 'DRM_DEV_ERROR'
   include/drm/drm_debug.h:94: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:94: warning: Excess function parameter 'arg' description in 'DRM_DEV_ERROR_RATELIMITED'
   include/drm/drm_debug.h:119: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:119: warning: Excess function parameter 'arg' description in 'DRM_DEV_DEBUG'
   include/drm/drm_debug.h:170: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:170: warning: Excess function parameter 'arg' description in 'DRM_DEV_DEBUG_RATELIMITED'
   drivers/gpu/drm/drm_debug.c:1: warning: no structured comments found
   drivers/gpu/host1x/bus.c:50: warning: No description found for parameter 'driver'
   drivers/gpu/drm/tve200/tve200_drv.c:1: warning: no structured comments found
   Documentation/core-api/kernel-api.rst:354: ERROR: Error in "kernel-doc" directive:
   unknown option: "external".

vim +76 include/drm/drm_debug.h

9bb12800 Haneen Mohammed 2017-10-10   46  
9bb12800 Haneen Mohammed 2017-10-10   47  #define _DRM_PRINTK(once, level, fmt, ...)				\
9bb12800 Haneen Mohammed 2017-10-10   48  	do {								\
9bb12800 Haneen Mohammed 2017-10-10   49  		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
9bb12800 Haneen Mohammed 2017-10-10   50  			     ##__VA_ARGS__);				\
9bb12800 Haneen Mohammed 2017-10-10   51  	} while (0)
9bb12800 Haneen Mohammed 2017-10-10   52  
9bb12800 Haneen Mohammed 2017-10-10   53  #define DRM_INFO(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   54  	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   55  #define DRM_NOTE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   56  	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   57  #define DRM_WARN(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   58  	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   59  
9bb12800 Haneen Mohammed 2017-10-10   60  #define DRM_INFO_ONCE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   61  	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   62  #define DRM_NOTE_ONCE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   63  	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   64  #define DRM_WARN_ONCE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   65  	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   66  
9bb12800 Haneen Mohammed 2017-10-10   67  /**
9bb12800 Haneen Mohammed 2017-10-10   68   * Error output.
9bb12800 Haneen Mohammed 2017-10-10   69   *
a9af8b82 Haneen Mohammed 2017-10-10   70   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10   71   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10   72   */
9bb12800 Haneen Mohammed 2017-10-10   73  #define DRM_DEV_ERROR(dev, fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10   74  	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
9bb12800 Haneen Mohammed 2017-10-10   75  		       fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  @76  #define DRM_ERROR(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   77  	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   78  
9bb12800 Haneen Mohammed 2017-10-10   79  /**
9bb12800 Haneen Mohammed 2017-10-10   80   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
9bb12800 Haneen Mohammed 2017-10-10   81   *
a9af8b82 Haneen Mohammed 2017-10-10   82   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10   83   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10   84   */
9bb12800 Haneen Mohammed 2017-10-10   85  #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
9bb12800 Haneen Mohammed 2017-10-10   86  ({									\
9bb12800 Haneen Mohammed 2017-10-10   87  	static DEFINE_RATELIMIT_STATE(_rs,				\
9bb12800 Haneen Mohammed 2017-10-10   88  				      DEFAULT_RATELIMIT_INTERVAL,	\
9bb12800 Haneen Mohammed 2017-10-10   89  				      DEFAULT_RATELIMIT_BURST);		\
9bb12800 Haneen Mohammed 2017-10-10   90  									\
9bb12800 Haneen Mohammed 2017-10-10   91  	if (__ratelimit(&_rs))						\
9bb12800 Haneen Mohammed 2017-10-10   92  		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
9bb12800 Haneen Mohammed 2017-10-10   93  })
9bb12800 Haneen Mohammed 2017-10-10  @94  #define DRM_ERROR_RATELIMITED(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10   95  	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   96  
9bb12800 Haneen Mohammed 2017-10-10   97  #define DRM_DEV_INFO(dev, fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10   98  	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10   99  		       ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  100  
9bb12800 Haneen Mohammed 2017-10-10  101  #define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
9bb12800 Haneen Mohammed 2017-10-10  102  ({									\
9bb12800 Haneen Mohammed 2017-10-10  103  	static bool __print_once __read_mostly;				\
9bb12800 Haneen Mohammed 2017-10-10  104  	if (!__print_once) {						\
9bb12800 Haneen Mohammed 2017-10-10  105  		__print_once = true;					\
9bb12800 Haneen Mohammed 2017-10-10  106  		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
9bb12800 Haneen Mohammed 2017-10-10  107  	}								\
9bb12800 Haneen Mohammed 2017-10-10  108  })
9bb12800 Haneen Mohammed 2017-10-10  109  
9bb12800 Haneen Mohammed 2017-10-10  110  /**
9bb12800 Haneen Mohammed 2017-10-10  111   * Debug output.
9bb12800 Haneen Mohammed 2017-10-10  112   *
a9af8b82 Haneen Mohammed 2017-10-10  113   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10  114   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10  115   */
9bb12800 Haneen Mohammed 2017-10-10  116  #define DRM_DEV_DEBUG(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  117  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10  118  		       ##args)
9bb12800 Haneen Mohammed 2017-10-10 @119  #define DRM_DEBUG(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10  120  	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  121  
9bb12800 Haneen Mohammed 2017-10-10  122  #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  123  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
9bb12800 Haneen Mohammed 2017-10-10  124  		       fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  125  #define DRM_DEBUG_DRIVER(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  126  	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  127  
9bb12800 Haneen Mohammed 2017-10-10  128  #define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  129  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10  130  		       ##args)
9bb12800 Haneen Mohammed 2017-10-10  131  #define DRM_DEBUG_KMS(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  132  	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  133  
9bb12800 Haneen Mohammed 2017-10-10  134  #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  135  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
9bb12800 Haneen Mohammed 2017-10-10  136  		       fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  137  #define DRM_DEBUG_PRIME(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  138  	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  139  
9bb12800 Haneen Mohammed 2017-10-10  140  #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  141  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
9bb12800 Haneen Mohammed 2017-10-10  142  		       fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  143  #define DRM_DEBUG_ATOMIC(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  144  	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  145  
9bb12800 Haneen Mohammed 2017-10-10  146  #define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  147  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10  148  		       ##args)
9bb12800 Haneen Mohammed 2017-10-10  149  #define DRM_DEBUG_VBL(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  150  	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  151  
9bb12800 Haneen Mohammed 2017-10-10  152  #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
9bb12800 Haneen Mohammed 2017-10-10  153  ({									\
9bb12800 Haneen Mohammed 2017-10-10  154  	static DEFINE_RATELIMIT_STATE(_rs,				\
9bb12800 Haneen Mohammed 2017-10-10  155  				      DEFAULT_RATELIMIT_INTERVAL,	\
9bb12800 Haneen Mohammed 2017-10-10  156  				      DEFAULT_RATELIMIT_BURST);		\
9bb12800 Haneen Mohammed 2017-10-10  157  	if (__ratelimit(&_rs))						\
9bb12800 Haneen Mohammed 2017-10-10  158  		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
9bb12800 Haneen Mohammed 2017-10-10  159  			       __func__, "", fmt, ##args);		\
9bb12800 Haneen Mohammed 2017-10-10  160  })
9bb12800 Haneen Mohammed 2017-10-10  161  
9bb12800 Haneen Mohammed 2017-10-10  162  /**
9bb12800 Haneen Mohammed 2017-10-10  163   * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
9bb12800 Haneen Mohammed 2017-10-10  164   *
a9af8b82 Haneen Mohammed 2017-10-10  165   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10  166   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10  167   */
9bb12800 Haneen Mohammed 2017-10-10  168  #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
9bb12800 Haneen Mohammed 2017-10-10  169  	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10 @170  #define DRM_DEBUG_RATELIMITED(fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  171  	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  172  #define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
9bb12800 Haneen Mohammed 2017-10-10  173  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  174  #define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
9bb12800 Haneen Mohammed 2017-10-10  175  	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  176  #define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
9bb12800 Haneen Mohammed 2017-10-10  177  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  178  #define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  179  	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  180  #define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
9bb12800 Haneen Mohammed 2017-10-10  181  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  182  #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
9bb12800 Haneen Mohammed 2017-10-10  183  	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  184  

:::::: The code at line 76 was first introduced by commit
:::::: 9bb12800de11fbffc46f4a438ef6829efeced9eb drm: Extract drm_debug.[hc]

:::::: TO: Haneen Mohammed <hamohammed.sa@gmail.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6771 bytes --]

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

* Re: [PATCH 2/2] drm: Update old comment style
@ 2017-10-13  0:40     ` kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2017-10-13  0:40 UTC (permalink / raw)
  To: Haneen Mohammed
  Cc: Daniel Vetter, gregkh, kbuild-all, dri-devel, outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 16767 bytes --]

Hi Haneen,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Extract-drm_debug-hc/20171013-052937
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
   kernel/trace/blktrace.c:824: warning: No description found for parameter 'cgid'
   drivers/gpio/gpiolib.c:593: warning: No description found for parameter '16'
   drivers/gpio/gpiolib.c:593: warning: Excess struct/union/enum/typedef member 'events' description in 'lineevent_state'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'claimed'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 'enabled'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_altset_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_stall_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 'quirk_zlp_not_supp'
   fs/inode.c:1680: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_list'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_type'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits'
   include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no'
   fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_pin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_unpin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_res_obj'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_get_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_import_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_vunmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 'gem_prime_mmap'
   include/drm/drm_mode_config.h:771: warning: No description found for parameter 'modifiers_property'
   include/drm/drm_mode_config.h:771: warning: Excess struct/union/enum/typedef member 'modifiers' description in 'drm_mode_config'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifiers'
   include/drm/drm_plane.h:552: warning: No description found for parameter 'modifier_count'
   include/drm/drm_debug.h:76: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:76: warning: Excess function parameter 'arg' description in 'DRM_DEV_ERROR'
   include/drm/drm_debug.h:94: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:94: warning: Excess function parameter 'arg' description in 'DRM_DEV_ERROR_RATELIMITED'
   include/drm/drm_debug.h:119: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:119: warning: Excess function parameter 'arg' description in 'DRM_DEV_DEBUG'
   include/drm/drm_debug.h:170: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:170: warning: Excess function parameter 'arg' description in 'DRM_DEV_DEBUG_RATELIMITED'
   drivers/gpu/drm/drm_debug.c:1: warning: no structured comments found
   drivers/gpu/host1x/bus.c:50: warning: No description found for parameter 'driver'
   drivers/gpu/drm/tve200/tve200_drv.c:1: warning: no structured comments found
   Documentation/core-api/kernel-api.rst:354: ERROR: Error in "kernel-doc" directive:
   unknown option: "external".

vim +76 include/drm/drm_debug.h

9bb12800 Haneen Mohammed 2017-10-10   46  
9bb12800 Haneen Mohammed 2017-10-10   47  #define _DRM_PRINTK(once, level, fmt, ...)				\
9bb12800 Haneen Mohammed 2017-10-10   48  	do {								\
9bb12800 Haneen Mohammed 2017-10-10   49  		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
9bb12800 Haneen Mohammed 2017-10-10   50  			     ##__VA_ARGS__);				\
9bb12800 Haneen Mohammed 2017-10-10   51  	} while (0)
9bb12800 Haneen Mohammed 2017-10-10   52  
9bb12800 Haneen Mohammed 2017-10-10   53  #define DRM_INFO(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   54  	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   55  #define DRM_NOTE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   56  	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   57  #define DRM_WARN(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   58  	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   59  
9bb12800 Haneen Mohammed 2017-10-10   60  #define DRM_INFO_ONCE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   61  	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   62  #define DRM_NOTE_ONCE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   63  	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   64  #define DRM_WARN_ONCE(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   65  	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   66  
9bb12800 Haneen Mohammed 2017-10-10   67  /**
9bb12800 Haneen Mohammed 2017-10-10   68   * Error output.
9bb12800 Haneen Mohammed 2017-10-10   69   *
a9af8b82 Haneen Mohammed 2017-10-10   70   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10   71   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10   72   */
9bb12800 Haneen Mohammed 2017-10-10   73  #define DRM_DEV_ERROR(dev, fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10   74  	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
9bb12800 Haneen Mohammed 2017-10-10   75  		       fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  @76  #define DRM_ERROR(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10   77  	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   78  
9bb12800 Haneen Mohammed 2017-10-10   79  /**
9bb12800 Haneen Mohammed 2017-10-10   80   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
9bb12800 Haneen Mohammed 2017-10-10   81   *
a9af8b82 Haneen Mohammed 2017-10-10   82   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10   83   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10   84   */
9bb12800 Haneen Mohammed 2017-10-10   85  #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
9bb12800 Haneen Mohammed 2017-10-10   86  ({									\
9bb12800 Haneen Mohammed 2017-10-10   87  	static DEFINE_RATELIMIT_STATE(_rs,				\
9bb12800 Haneen Mohammed 2017-10-10   88  				      DEFAULT_RATELIMIT_INTERVAL,	\
9bb12800 Haneen Mohammed 2017-10-10   89  				      DEFAULT_RATELIMIT_BURST);		\
9bb12800 Haneen Mohammed 2017-10-10   90  									\
9bb12800 Haneen Mohammed 2017-10-10   91  	if (__ratelimit(&_rs))						\
9bb12800 Haneen Mohammed 2017-10-10   92  		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
9bb12800 Haneen Mohammed 2017-10-10   93  })
9bb12800 Haneen Mohammed 2017-10-10  @94  #define DRM_ERROR_RATELIMITED(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10   95  	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10   96  
9bb12800 Haneen Mohammed 2017-10-10   97  #define DRM_DEV_INFO(dev, fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10   98  	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10   99  		       ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  100  
9bb12800 Haneen Mohammed 2017-10-10  101  #define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
9bb12800 Haneen Mohammed 2017-10-10  102  ({									\
9bb12800 Haneen Mohammed 2017-10-10  103  	static bool __print_once __read_mostly;				\
9bb12800 Haneen Mohammed 2017-10-10  104  	if (!__print_once) {						\
9bb12800 Haneen Mohammed 2017-10-10  105  		__print_once = true;					\
9bb12800 Haneen Mohammed 2017-10-10  106  		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
9bb12800 Haneen Mohammed 2017-10-10  107  	}								\
9bb12800 Haneen Mohammed 2017-10-10  108  })
9bb12800 Haneen Mohammed 2017-10-10  109  
9bb12800 Haneen Mohammed 2017-10-10  110  /**
9bb12800 Haneen Mohammed 2017-10-10  111   * Debug output.
9bb12800 Haneen Mohammed 2017-10-10  112   *
a9af8b82 Haneen Mohammed 2017-10-10  113   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10  114   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10  115   */
9bb12800 Haneen Mohammed 2017-10-10  116  #define DRM_DEV_DEBUG(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  117  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10  118  		       ##args)
9bb12800 Haneen Mohammed 2017-10-10 @119  #define DRM_DEBUG(fmt, ...)						\
9bb12800 Haneen Mohammed 2017-10-10  120  	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  121  
9bb12800 Haneen Mohammed 2017-10-10  122  #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  123  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
9bb12800 Haneen Mohammed 2017-10-10  124  		       fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  125  #define DRM_DEBUG_DRIVER(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  126  	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  127  
9bb12800 Haneen Mohammed 2017-10-10  128  #define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  129  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10  130  		       ##args)
9bb12800 Haneen Mohammed 2017-10-10  131  #define DRM_DEBUG_KMS(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  132  	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  133  
9bb12800 Haneen Mohammed 2017-10-10  134  #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  135  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
9bb12800 Haneen Mohammed 2017-10-10  136  		       fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  137  #define DRM_DEBUG_PRIME(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  138  	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  139  
9bb12800 Haneen Mohammed 2017-10-10  140  #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  141  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
9bb12800 Haneen Mohammed 2017-10-10  142  		       fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  143  #define DRM_DEBUG_ATOMIC(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  144  	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  145  
9bb12800 Haneen Mohammed 2017-10-10  146  #define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  147  	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
9bb12800 Haneen Mohammed 2017-10-10  148  		       ##args)
9bb12800 Haneen Mohammed 2017-10-10  149  #define DRM_DEBUG_VBL(fmt, ...)					\
9bb12800 Haneen Mohammed 2017-10-10  150  	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
9bb12800 Haneen Mohammed 2017-10-10  151  
9bb12800 Haneen Mohammed 2017-10-10  152  #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
9bb12800 Haneen Mohammed 2017-10-10  153  ({									\
9bb12800 Haneen Mohammed 2017-10-10  154  	static DEFINE_RATELIMIT_STATE(_rs,				\
9bb12800 Haneen Mohammed 2017-10-10  155  				      DEFAULT_RATELIMIT_INTERVAL,	\
9bb12800 Haneen Mohammed 2017-10-10  156  				      DEFAULT_RATELIMIT_BURST);		\
9bb12800 Haneen Mohammed 2017-10-10  157  	if (__ratelimit(&_rs))						\
9bb12800 Haneen Mohammed 2017-10-10  158  		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
9bb12800 Haneen Mohammed 2017-10-10  159  			       __func__, "", fmt, ##args);		\
9bb12800 Haneen Mohammed 2017-10-10  160  })
9bb12800 Haneen Mohammed 2017-10-10  161  
9bb12800 Haneen Mohammed 2017-10-10  162  /**
9bb12800 Haneen Mohammed 2017-10-10  163   * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
9bb12800 Haneen Mohammed 2017-10-10  164   *
a9af8b82 Haneen Mohammed 2017-10-10  165   * @fmt: printf() like format string.
a9af8b82 Haneen Mohammed 2017-10-10  166   * @arg: arguments
9bb12800 Haneen Mohammed 2017-10-10  167   */
9bb12800 Haneen Mohammed 2017-10-10  168  #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
9bb12800 Haneen Mohammed 2017-10-10  169  	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10 @170  #define DRM_DEBUG_RATELIMITED(fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  171  	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  172  #define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
9bb12800 Haneen Mohammed 2017-10-10  173  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  174  #define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
9bb12800 Haneen Mohammed 2017-10-10  175  	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  176  #define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
9bb12800 Haneen Mohammed 2017-10-10  177  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  178  #define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
9bb12800 Haneen Mohammed 2017-10-10  179  	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  180  #define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
9bb12800 Haneen Mohammed 2017-10-10  181  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  182  #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
9bb12800 Haneen Mohammed 2017-10-10  183  	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
9bb12800 Haneen Mohammed 2017-10-10  184  

:::::: The code at line 76 was first introduced by commit
:::::: 9bb12800de11fbffc46f4a438ef6829efeced9eb drm: Extract drm_debug.[hc]

:::::: TO: Haneen Mohammed <hamohammed.sa@gmail.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6771 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-10-13  0:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1507693829.git.hamohammed.sa@gmail.com>
2017-10-11  4:13 ` [PATCH 1/2] drm: Extract drm_debug.[hc] Haneen Mohammed
2017-10-11  4:13   ` Haneen Mohammed
2017-10-11 10:12   ` Ville Syrjälä
2017-10-11 10:12     ` Ville Syrjälä
2017-10-11 11:40   ` Daniel Vetter
2017-10-11 11:40     ` Daniel Vetter
2017-10-11 21:55     ` Haneen Mohammed
2017-10-11 21:55       ` Haneen Mohammed
2017-10-12 23:32   ` kbuild test robot
2017-10-12 23:32     ` kbuild test robot
2017-10-11  4:16 ` [PATCH 2/2] drm: Update old comment style Haneen Mohammed
2017-10-11  4:16   ` Haneen Mohammed
2017-10-11 11:42   ` Daniel Vetter
2017-10-11 11:42     ` Daniel Vetter
2017-10-13  0:40   ` kbuild test robot
2017-10-13  0:40     ` kbuild test robot

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.