Skip to content

Commit 6b09448

Browse files
David Brownellgregkh
authored andcommitted
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>
1 parent aebdc3b commit 6b09448

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎Documentation/CodingStyle‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,27 @@ covers RTL which is used frequently with assembly language in the kernel.
633633

634634
Kernel developers like to be seen as literate. Do mind the spelling
635635
of kernel messages to make a good impression. Do not use crippled
636-
words like "dont" and use "do not" or "don't" instead.
636+
words like "dont"; use "do not" or "don't" instead. Make the messages
637+
concise, clear, and unambiguous.
637638

638639
Kernel messages do not have to be terminated with a period.
639640

640641
Printing numbers in parentheses (%d) adds no value and should be avoided.
641642

643+
There are a number of driver model diagnostic macros in <linux/device.h>
644+
which you should use to make sure messages are matched to the right device
645+
and driver, and are tagged with the right level: dev_err(), dev_warn(),
646+
dev_info(), and so forth. For messages that aren't associated with a
647+
particular device, <linux/kernel.h> defines pr_debug() and pr_info().
648+
649+
Coming up with good debugging messages can be quite a challenge; and once
650+
you have them, they can be a huge help for remote troubleshooting. Such
651+
messages should be compiled out when the DEBUG symbol is not defined (that
652+
is, by default they are not included). When you use dev_dbg() or pr_debug(),
653+
that's automatic. Many subsystems have Kconfig options to turn on -DDEBUG.
654+
A related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to the
655+
ones already enabled by DEBUG.
656+
642657

643658
Chapter 14: Allocating memory
644659

@@ -790,4 +805,5 @@ Kernel CodingStyle, by greg@kroah.com at OLS 2002:
790805
http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/
791806

792807
--
793-
Last updated on 2006-December-06.
808+
Last updated on 2007-July-13.
809+

0 commit comments

Comments
 (0)