From: yogesh <mr.yogesh@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Joe Perches <joe@perches.com>, Levente Kurusa <levex@linux.com>
Subject: [PATCH 1/1] Add documentation for proper usage and order of preference of calls to print diagnostic messages.
Date: Tue, 4 Mar 2014 17:18:14 +0530 [thread overview]
Message-ID: <20140304114814.GA28031@yogesh-Dell-System-XPS-L502X> (raw)
This patch adds documentation that clarifies the use of various diagnostic printing messages. It shows the preference of subsystem_dbg calls to dev_dbg (whenever possible), as the first preferred format of logging debug messages.
Signed-off-by: Yogesh Chaudhari <mr.yogesh@gmail.com>
---
Documentation/CodingStyle | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 7fe0546..9e0de25 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -662,6 +662,20 @@ 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/printk.h> defines pr_debug() and pr_info().
+If the subsystem has its own diagnostic macros then they should be used
+instead of dev_dbg calls.
+e.g. If you are using network subsystem, use netdev_dbg;
+if you are using V4L, use v4l_dbg etc.
+This standardises the output format in every subsystem.
+
+Depending on your changes, the following order of precedence
+applies to printing messages:
+1. [subsystem]_dbg() is preferred when you the
+subsystem has its own diagnostic macros.
+2. dev_dbg() is preferred when you have a generic struct device object.
+3. pr_debug() is used when 1 and 2 above are not applicable.
+4. printk() should be avoided.
+
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
next reply other threads:[~2014-03-04 11:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-04 11:48 yogesh [this message]
2014-03-04 13:39 ` Levente Kurusa
2014-03-04 14:31 ` yogesh
2014-03-04 14:50 ` Levente Kurusa
2014-03-04 16:27 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140304114814.GA28031@yogesh-Dell-System-XPS-L502X \
--to=mr.yogesh@gmail.com \
--cc=joe@perches.com \
--cc=levex@linux.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®