mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jason Baron <jbaron@redhat.com>
Cc: Jim Cromie <jim.cromie@gmail.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: RFC: dynamic debug enhancements?
Date: Tue, 23 Aug 2011 18:00:05 -0700	[thread overview]
Message-ID: <1314147605.1659.40.camel@Joe-Laptop> (raw)
In-Reply-To: <20110823142311.GB2526@redhat.com>

On Tue, 2011-08-23 at 10:23 -0400, Jason Baron wrote:
> On Sun, Aug 21, 2011 at 05:15:43PM -0700, Joe Perches wrote:
> > I recently went through drivers/media and updated
> > lots of calls to pr_<level>.
> > A common pattern for debugging there and elsewhere
> > treewide is the use of macros like:
> > #define dprintk(level, fmt, ...)			\
> > do {							\
> > 	if (level > [some_modparam_var])		\
> > 		pr_debug(fmt, ##__VA_ARGS__);		\
> > } while (0)
> > and
> > #define dprintk(mask, fmt, ...)				\
> > do {							\
> > 	if (mask & [some_modparam_var])			\
> > 		pr_debug(fmt, ##__VA_ARGS__);		\
> > } while (0)
> > It might be useful to have standardized calls
> > like pr_debug_level and pr_debug_mask instead
> > of multiple hand-rolled variants treewide.
[]
> looks interesting. I'm wondering how we handle module parameters though?
> In the dynamic debug disabled case, we'd have to standardize the module
> params names. And for the dynamic debug enabled case, I'm not sure how
> we would honor those module params?

One possibility would be to require a #define
before use.

Something like the DEBUG_VARIABLE used in
drivers/media/ and include/media/.

Maybe something like:

#define DYNAMIC_DEBUG_LEVEL_VARIABLE module_var_foo
and/or
#define DYNAMIC_DEBUG_MASK_VARIABLE module_var_bar

and

$ echo 'module <foo> mask <n>' > <debugfs>/dynamic_debug/control
and
$ echo 'module <foo> level <n>' > <debugfs>/dynamic_debug/control

could work to set the module control variable too.



  reply	other threads:[~2011-08-24  1:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22  0:15 Joe Perches
2011-08-23 14:23 ` Jason Baron
2011-08-24  1:00   ` Joe Perches [this message]
2011-08-29 18:21     ` Jim Cromie
2011-08-29 18:35       ` Joe Perches

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=1314147605.1659.40.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=jbaron@redhat.com \
    --cc=jim.cromie@gmail.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®