lkml.org 
[lkml]   [2011]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 25/26] dynamic_debug: add pr_fmt_dbg() for dynamic_pr_debug
From
Date
On Tue, 2011-09-27 at 14:37 -0600, Jim Cromie wrote:
> On Thu, Sep 22, 2011 at 2:57 PM, Joe Perches <joe@perches.com> wrote:
> > On Wed, 2011-09-21 at 15:55 -0600, jim.cromie@gmail.com wrote:
> >> dynamic_pr_debug can add module, function, file, and line selectively,
> > []
> >> diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> > []
> >> +#ifndef pr_fmt_dbg
> >> +#define pr_fmt_dbg(fmt) fmt
> >> +#endif
> > []
> >> +#ifndef pr_fmt_dbg
> >> +#define pr_fmt_dbg(fmt) pr_fmt(fmt)
> >> +#endif
> >
> > This might better be placed in printk.h just
> > once.
> >
>
> yes. it seems to work smoothly.
> Only minor annoyance is having to put local defns
> above the #includes, but thats no different than previously.
>
>
> > I think pr_fmt_debug is better than pr_fmt_dbg
> > because the function/macro is named pr_debug.
>
> Ok. Done.
>
> > Maybe add all the pr_<level> variants too because
> > some like to prefix __func__ to pr_err but not pr_info
> > etc.
> >
>
> Done. Only wrinkle is wrt pr_warning() vs pr_warn()
> I added to your suggestion:
> +#define pr_fmt_warn pr_fmt_warning
>
> the imperfection is that user has 4 combos of warn/warning
> rather than 2 pairs, but the latter seems less defensible.

I'd just use pr_fmt_warn.

Instead of all this other extra stuff:

What did you think of avoiding all of this and
having __dynamic_pr_debug move the fmt pointer over
any initial KBUILD_MODULE ": "

int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
{
[...]
size_t modsize = strlen(descriptor->modname);
if (0 == strncmp(fmt, descriptor->modname, modsize) &&
0 == strncmp(fmt + modsize, ": ", 2))
fmt += modsize + 2;

vprintk(fmt, ...)

?



\
 
 \ /
  Last update: 2011-09-28 01:39    [W:0.135 / U:7.564 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site