[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfuBxx_aWCGPKmnpz0Zj60sFmOAKL1NNBQ5=ekQxAAqVT+Few@mail.gmail.com>
Date: Mon, 25 Jul 2011 23:54:51 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: jbaron@...hat.com, bvanassche@....org, gregkh@...e.de,
linux-kernel@...r.kernel.org, gnb@...h.org
Subject: Re: [PATCH 24/25] dynamic_debug: drop pr_fmt() from dynamic_pr_debug
On Mon, Jul 25, 2011 at 9:45 PM, Joe Perches <joe@...ches.com> wrote:
> On Mon, 2011-07-25 at 15:42 -0600, Jim Cromie wrote:
>> dynamic_pr_debug can add module, function, file, and line selectively,
>> theres no need to also add them via macro. Moreover, adding them
>> via the macro, which is useful for pr_info and friends, causes
>> pr_debug to double-print those fields added by the flag-settings.
> []
>> - __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__);\
>> + __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
>
> Hey Jim.
>
> Thinking about a bit more, maybe it's possible to use
> another test to see if the current pr_fmt is:
>
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> and not add pr_fmt when appropriate.
>
> I tried this once. I recall it worked without adding any
> new string dependencies. It did depend on __builtin_strcmp.
>
> +#define _first_macro_arg(arg1, args...) arg1
> +#define first_macro_arg(arg1, args...) _first_macro_arg(arg1)
> +
> +#define define_kernel_printk_level(level, fmt, ...) \
> +do { \
> + if (__builtin_strcmp(first_macro_arg(pr_fmt(fmt)), \
> + KBUILD_MODNAME ": " fmt)) \
> + printk(level pr_fmt(fmt), ##__VA_ARGS__); \
> + else \
> + printk(level fmt, ##__VA_ARGS__); \
> +} while (0)
>
>
>
>
hi Joe,
In case it wasnt clear, the idea was to leave pr_fmt as is for use
with pr_info, etc.
Providing another, separate macro for the purpose would seem most
straightforward:
#define pr_dbg_fmt ( fmt ) fmt
>> - __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__);\
>> + __dynamic_pr_debug(&descriptor, pr_dbg_fmt(fmt), ##__VA_ARGS__); \
would this address your concerns ?
It doesnt allow arbitrary insertion of extra punctuation, etc between
file, func, module, line, nor rearrange the ordering, but thats
probably overkill.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists