|author||David Brownell <firstname.lastname@example.org>||2007-07-13 16:32:09 -0700|
|committer||Greg Kroah-Hartman <email@example.com>||2007-07-18 15:49:50 -0700|
Update CodingStyle to talk about "-DDEBUG" message conventions and the new "-DVERBOSE_DEBUG" convention. Signed-off-by: David Brownell <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
Diffstat (limited to 'Documentation/CodingStyle')
1 files changed, 18 insertions, 2 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index a667eb1fc26e..7f1730f1a1ae 100644
@@ -633,12 +633,27 @@ covers RTL which is used frequently with assembly language in the kernel.
Kernel developers like to be seen as literate. Do mind the spelling
of kernel messages to make a good impression. Do not use crippled
-words like "dont" and use "do not" or "don't" instead.
+words like "dont"; use "do not" or "don't" instead. Make the messages
+concise, clear, and unambiguous.
Kernel messages do not have to be terminated with a period.
Printing numbers in parentheses (%d) adds no value and should be avoided.
+There are a number of driver model diagnostic macros in <linux/device.h>
+which you should use to make sure messages are matched to the right device
+and driver, and are tagged with the right level: dev_err(), dev_warn(),
+dev_info(), and so forth. For messages that aren't associated with a
+particular device, <linux/kernel.h> defines pr_debug() and pr_info().
+Coming up with good debugging messages can be quite a challenge; and once
+you have them, they can be a huge help for remote troubleshooting. Such
+messages should be compiled out when the DEBUG symbol is not defined (that
+is, by default they are not included). When you use dev_dbg() or pr_debug(),
+that's automatic. Many subsystems have Kconfig options to turn on -DDEBUG.
+A related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to the
+ones already enabled by DEBUG.
Chapter 14: Allocating memory
@@ -790,4 +805,5 @@ Kernel CodingStyle, by email@example.com at OLS 2002:
-Last updated on 2006-December-06.
+Last updated on 2007-July-13.