public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Erez Zadok <ezk@cs.sunysb.edu>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, "Kok,
	Auke" <auke-jan.h.kok@intel.com>,
	Kyle Moffett <mrmacman_g4@mac.com>,
	Jan Engelhardt <jengelh@computergmbh.de>,
	Adrian Bunk <bunk@kernel.org>, roel <12o3l@tiscali.nl>
Subject: Re: [PATCH 1/3] CodingStyle updates
Date: Sat, 29 Sep 2007 20:29:09 +0200	[thread overview]
Message-ID: <20070929182909.GA19943@uranus.ravnborg.org> (raw)
In-Reply-To: <20070929110129.307cbd9f.randy.dunlap@oracle.com>

On Sat, Sep 29, 2007 at 11:01:29AM -0700, Randy Dunlap wrote:
> On Fri, 28 Sep 2007 17:32:00 -0400 Erez Zadok wrote:
> 
> > 1. Updates chapter 13 (printing kernel messages) to expand on the use of
> >    pr_debug()/pr_info(), what to avoid, and how to hook your debug code with
> >    kernel.h.
> > 
> > Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
> > ---
> >  Documentation/CodingStyle |   88 +++++++++++++++++++++++++++++++++++++++++++-
> >  1 files changed, 86 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> > index 7f1730f..00b29e4 100644
> > --- a/Documentation/CodingStyle
> > +++ b/Documentation/CodingStyle
> > @@ -643,8 +643,26 @@ 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().
> > +dev_info(), and so forth.
> > +
> > +A number of people often like to define their own debugging printf's,
> > +wrapping printk's in #ifdef's that get turned on only when subsystem
> > +debugging is compiled in (e.g., dprintk, Dprintk, DPRINTK, etc.).  Please
> > +don't reinvent the wheel but use existing mechanisms.  For messages that
> > +aren't associated with a particular device, <linux/kernel.h> defines
> > +pr_debug() and pr_info(); the latter two translate to printk(KERN_DEBUG) and
> > +printk(KERN_INFO), respectively.  However, to get pr_debug() to actually
> > +emit the message, you'll need to turn on DEBUG in your code, which can be
> > +done as follows in your subsystem Makefile:
> > +
> > +ifeq ($(CONFIG_WHATEVER_DEBUG),y)
> > +EXTRA_CFLAGS += -DDEBUG
> > +endif
The abvoe hurst my eyes each time I see it.
Lately I have considered extending the kbuild syntax a bit.

Introducing
ccflags-y
asflags-y

[with same functionality as the EXTRA_CFLAGS, EXTRA_AFLAGS]
would allow us to do:

ccflags-$(CONFIG_WHATEVER_DEBUG) := -DDEBUG

Much nicer IMHO.

	Sam

  reply	other threads:[~2007-09-29 18:27 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 21:31 [PATCH] 0/3 coding standards documentation/code updates Erez Zadok
2007-09-28 21:32 ` [PATCH 1/3] CodingStyle updates Erez Zadok
2007-09-28 21:46   ` Randy Dunlap
2007-09-29 14:43   ` Shawn Bohrer
2007-09-29 15:59   ` Scott Preece
2007-09-29 18:01   ` Randy Dunlap
2007-09-29 18:29     ` Sam Ravnborg [this message]
2007-09-29 20:21       ` [OT] kbuild syntax extension for ccflags and asflags (was: [PATCH 1/3] CodingStyle updates) Ingo Oeser
2007-09-29 20:24         ` Sam Ravnborg
2007-09-28 21:32 ` [PATCH 2/3] Update usage string for checkpatch.pl Erez Zadok
2007-09-28 21:32 ` [PATCH 3/3] New script to check coding-style compliance on multiple regular files Erez Zadok
2007-09-29 10:10   ` Sam Ravnborg
2007-09-29 18:18 ` [PATCH] 0/3 coding standards documentation/code updates Linus Torvalds
2007-09-29 19:56   ` J. Bruce Fields
2007-09-29 20:14     ` Randy Dunlap
2007-09-30  2:06     ` Theodore Tso
2007-09-30  3:28       ` Erez Zadok
2007-09-29 21:56   ` Robert P. J. Day
2007-09-30  0:23   ` Erez Zadok
2007-09-30  0:49     ` Linus Torvalds
2007-09-30  4:01       ` Erez Zadok
2007-09-30 17:40         ` Mark Lord
2007-09-30 17:59           ` Randy Dunlap
2007-09-30  2:24   ` Valdis.Kletnieks
2007-09-30  3:00     ` Linus Torvalds
2007-09-30  3:29       ` Valdis.Kletnieks
2007-09-30  3:35         ` Linus Torvalds
2007-09-30 17:57         ` Theodore Tso
2007-09-30  3:27     ` Al Viro
2007-09-30  3:39       ` Valdis.Kletnieks

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=20070929182909.GA19943@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=12o3l@tiscali.nl \
    --cc=akpm@linux-foundation.org \
    --cc=auke-jan.h.kok@intel.com \
    --cc=bunk@kernel.org \
    --cc=ezk@cs.sunysb.edu \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrmacman_g4@mac.com \
    --cc=randy.dunlap@oracle.com \
    --cc=torvalds@linux-foundation.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