Merge tag 'stable/for-linus-3.6-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / include / linux / dynamic_debug.h
index 7e3c53a900d8efe75796c8e35a9f14f91b1a8fd8..c18257b0fa7219df00fb5c991cfcfe7c8f5e135a 100644 (file)
@@ -17,8 +17,8 @@ struct _ddebug {
        const char *format;
        unsigned int lineno:18;
        /*
-        * The flags field controls the behaviour at the callsite.
-        * The bits here are changed dynamically when the user
+        * The flags field controls the behaviour at the callsite.
+        * The bits here are changed dynamically when the user
         * writes commands to <debugfs>/dynamic_debug/control
         */
 #define _DPRINTK_FLAGS_NONE    0
@@ -44,6 +44,9 @@ extern int ddebug_remove_module(const char *mod_name);
 extern __printf(2, 3)
 int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
 
+extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
+                                       const char *modname);
+
 struct device;
 
 extern __printf(3, 4)
@@ -94,11 +97,26 @@ do {                                                                \
 
 #else
 
+#include <linux/string.h>
+#include <linux/errno.h>
+
 static inline int ddebug_remove_module(const char *mod)
 {
        return 0;
 }
 
+static inline int ddebug_dyndbg_module_param_cb(char *param, char *val,
+                                               const char *modname)
+{
+       if (strstr(param, "dyndbg")) {
+               /* avoid pr_warn(), which wants pr_fmt() fully defined */
+               printk(KERN_WARNING "dyndbg param is supported only in "
+                       "CONFIG_DYNAMIC_DEBUG builds\n");
+               return 0; /* allow and ignore */
+       }
+       return -EINVAL;
+}
+
 #define dynamic_pr_debug(fmt, ...)                                     \
        do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
 #define dynamic_dev_dbg(dev, fmt, ...)                                 \