All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Cc: Jim Cromie <jim.cromie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: RFC: Use dynamic-debug with pr_debug when -DDEBUG is set
Date: Wed, 10 Aug 2011 20:20:40 -0400	[thread overview]
Message-ID: <20110811002039.GA3552@redhat.com> (raw)
In-Reply-To: <1313020897.11924.137.camel@Joe-Laptop>

On Wed, Aug 10, 2011 at 05:01:37PM -0700, Joe Perches wrote:
> On Wed, 2011-08-10 at 16:50 -0700, Joe Perches wrote:
> > On Wed, 2011-08-10 at 15:06 -0600, Jim Cromie wrote:
> > > scx200_acb has several pr_debugs, but theyre not available via dynamic-debug
> > > Ive been unable to figure out why.
> > > Any ideas ?
> > -DDEBUG forces pr_debug to be output and doesn't
> > allow dynamic_debug for those outputs.
> > from drivers/i2c/busses/Makefile:
> > ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG
> > from printk.h:
> > /* If you are writing a driver, please use dev_dbg instead */
> > #if defined(DEBUG)
> > #define pr_debug(fmt, ...) \
> > 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> > #elif defined(CONFIG_DYNAMIC_DEBUG)
> > /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
> > #define pr_debug(fmt, ...) \
> > 	dynamic_pr_debug(fmt, ##__VA_ARGS__)
> 
> Perhaps another way to enable pr_debug use
> is to reverse the order of dynamic_pr_debug
> defines.
> 
> ie:  change printk.h:
> 
> #if defined(CONFIG_DYNAMIC_DEBUG)
> /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
> #define pr_debug(fmt, ...) \
> 	dynamic_pr_debug(fmt, ##__VA_ARGS__)
> #elif defined(DEBUG)
> #define pr_debug(fmt, ...) \
> 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> 
> and change dynamic_debug.h:
> 
> #define DPRINTK_FLAGS_DEFAULT 0
> 
> to:
> 
> #if defined DEBUG
> #define DPRINTK_FLAGS_DEFAULT DPRINTK_FLAGS_PRINT
> #else
> #define DPRINT_FLAGS_DEFAULT 0
> #endif
> 
> That seems pretty sensible to me.  Jason?
> 

cool idea. I like it.

-Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Baron <jbaron@redhat.com>
To: Joe Perches <joe@perches.com>
Cc: Jim Cromie <jim.cromie@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-i2c@vger.kernel.org
Subject: Re: RFC: Use dynamic-debug with pr_debug when -DDEBUG is set
Date: Wed, 10 Aug 2011 20:20:40 -0400	[thread overview]
Message-ID: <20110811002039.GA3552@redhat.com> (raw)
In-Reply-To: <1313020897.11924.137.camel@Joe-Laptop>

On Wed, Aug 10, 2011 at 05:01:37PM -0700, Joe Perches wrote:
> On Wed, 2011-08-10 at 16:50 -0700, Joe Perches wrote:
> > On Wed, 2011-08-10 at 15:06 -0600, Jim Cromie wrote:
> > > scx200_acb has several pr_debugs, but theyre not available via dynamic-debug
> > > Ive been unable to figure out why.
> > > Any ideas ?
> > -DDEBUG forces pr_debug to be output and doesn't
> > allow dynamic_debug for those outputs.
> > from drivers/i2c/busses/Makefile:
> > ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG
> > from printk.h:
> > /* If you are writing a driver, please use dev_dbg instead */
> > #if defined(DEBUG)
> > #define pr_debug(fmt, ...) \
> > 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> > #elif defined(CONFIG_DYNAMIC_DEBUG)
> > /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
> > #define pr_debug(fmt, ...) \
> > 	dynamic_pr_debug(fmt, ##__VA_ARGS__)
> 
> Perhaps another way to enable pr_debug use
> is to reverse the order of dynamic_pr_debug
> defines.
> 
> ie:  change printk.h:
> 
> #if defined(CONFIG_DYNAMIC_DEBUG)
> /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
> #define pr_debug(fmt, ...) \
> 	dynamic_pr_debug(fmt, ##__VA_ARGS__)
> #elif defined(DEBUG)
> #define pr_debug(fmt, ...) \
> 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> 
> and change dynamic_debug.h:
> 
> #define DPRINTK_FLAGS_DEFAULT 0
> 
> to:
> 
> #if defined DEBUG
> #define DPRINTK_FLAGS_DEFAULT DPRINTK_FLAGS_PRINT
> #else
> #define DPRINT_FLAGS_DEFAULT 0
> #endif
> 
> That seems pretty sensible to me.  Jason?
> 

cool idea. I like it.

-Jason

  reply	other threads:[~2011-08-11  0:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 21:06 dynamic-debug not built into scx200_acb, scx200_i2c Jim Cromie
     [not found] ` <CAJfuBxwq3xw3MZU01rwzg0NAnnxNoLrC2x0QXnj+2pD-6gkR4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-10 23:50   ` Joe Perches
2011-08-10 23:50     ` Joe Perches
2011-08-11  0:01     ` RFC: Use dynamic-debug with pr_debug when -DDEBUG is set Joe Perches
2011-08-11  0:01       ` Joe Perches
2011-08-11  0:20       ` Jason Baron [this message]
2011-08-11  0:20         ` Jason Baron
     [not found]         ` <20110811002039.GA3552-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-08-11  1:03           ` Joe Perches
2011-08-11  1:03             ` Joe Perches
2011-08-11  5:44             ` Jim Cromie
2011-08-11  5:44               ` Jim Cromie
     [not found]               ` <CAJfuBxyNBxs0hcTV=0N1UBYWnuXKsMUq3DC3GDgedRL5YX+34A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-11  6:06                 ` Joe Perches
2011-08-11  6:06                   ` Joe Perches
2011-08-10 23:52   ` dynamic-debug not built into scx200_acb, scx200_i2c Jason Baron
2011-08-10 23:52     ` Jason Baron

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=20110811002039.GA3552@redhat.com \
    --to=jbaron-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=jim.cromie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.