aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-07-13 19:32:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-18 18:49:50 -0400
commit6b09448ab81e90e59c09cfbc6d0d612dc84a2b1d (patch)
tree6c2fc89767cb438dc168dc867c9931b5425c5f46 /Documentation
parentaebdc3b450a3febf7d7d00cd2235509055ec7082 (diff)
dev_vdbg() documentation
Update CodingStyle to talk about "-DDEBUG" message conventions and the new "-DVERBOSE_DEBUG" convention. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/CodingStyle20
1 files changed, 18 insertions, 2 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index a667eb1fc26e..7f1730f1a1ae 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -633,12 +633,27 @@ covers RTL which is used frequently with assembly language in the kernel.
633 633
634Kernel developers like to be seen as literate. Do mind the spelling 634Kernel developers like to be seen as literate. Do mind the spelling
635of kernel messages to make a good impression. Do not use crippled 635of kernel messages to make a good impression. Do not use crippled
636words like "dont" and use "do not" or "don't" instead. 636words like "dont"; use "do not" or "don't" instead. Make the messages
637concise, clear, and unambiguous.
637 638
638Kernel messages do not have to be terminated with a period. 639Kernel messages do not have to be terminated with a period.
639 640
640Printing numbers in parentheses (%d) adds no value and should be avoided. 641Printing numbers in parentheses (%d) adds no value and should be avoided.
641 642
643There are a number of driver model diagnostic macros in <linux/device.h>
644which you should use to make sure messages are matched to the right device
645and driver, and are tagged with the right level: dev_err(), dev_warn(),
646dev_info(), and so forth. For messages that aren't associated with a
647particular device, <linux/kernel.h> defines pr_debug() and pr_info().
648
649Coming up with good debugging messages can be quite a challenge; and once
650you have them, they can be a huge help for remote troubleshooting. Such
651messages should be compiled out when the DEBUG symbol is not defined (that
652is, by default they are not included). When you use dev_dbg() or pr_debug(),
653that's automatic. Many subsystems have Kconfig options to turn on -DDEBUG.
654A related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to the
655ones already enabled by DEBUG.
656
642 657
643 Chapter 14: Allocating memory 658 Chapter 14: Allocating memory
644 659
@@ -790,4 +805,5 @@ Kernel CodingStyle, by greg@kroah.com at OLS 2002:
790http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/ 805http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/
791 806
792-- 807--
793Last updated on 2006-December-06. 808Last updated on 2007-July-13.
809