Re: [PATCH 25/26] dynamic_debug: add pr_fmt_dbg() fordynamic_pr_debug

From: Joe Perches
Date: Fri Sep 23 2011 - 13:42:22 EST


(resending with minor additions, first email hasn't shown up in 4+ hours)

On Fri, 2011-09-23 at 12:31 +0200, Bart Van Assche wrote:
> On Thu, Sep 22, 2011 at 10:57 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> > Maybe add all the pr_<level> variants too because
> > some like to prefix __func__ to pr_err but not pr_info
> > etc.
> Hi Joe,

Hi Bart.

> Are you sure it makes sense to introduce all these new macros ?
> Introducing pr_fmt_dbg() makes sense to me, but the usefulness of the
> macros proposed above is not clear to me.

Probably the most useful application of
pr_fmt_debug would be to prefix __func__ to
debug output but not to other pr_<level> uses.

dynamic_debug would not be able to detect that
__func__ duplication except by using vscnprintf
to a buffer and checking the initial output.

Perhaps a simpler way to avoid duplication of
KBUILD_MODNAME ":" in dynamic_debugging is to
scan the fmt string and move the fmt pointer
past any leading KBUILD_MODNAME ": " when
appropriate.

I think these pr_fmt_<level> macros have a
relatively low overall value but I prefer
comprehensive implementations rather than
partial ones.

There are a couple of modules where people
prefix __func__ to pr_err but not pr_info.

e.g.: drivers/net/ethernet/broadcom/cnic.c

Adding all the #define pr_fmt_<level>s could
simplify that.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/