Re: [PATCH 03/25] dynamic_debug: use pr_debug instead of pr_info

Bart Van Assche
2011-07-26T07:09:17Z

On Mon, Jul 25, 2011 at 11:42 PM, Jim Cromie <jim.cromie@gmail.com> wrote:
> Replace almost all occurrences of "if (verbose) pr_info()" with
> pr_debug(), and get full control of output at each callsite.
> Leave a few sites unaltered:
>
> 1st also uses pr_cont(), and theres no pr_debug_cont().
> 2nd is in ddebug_add_module(), which is called during arch_init,
> too early for callsite to be enabled when called.
>
> 3rd, pr_debug doesnt work in dynamic_debug_init(), its too early.
> Also move the print ddebug_setup_string prior to parsing, since
> afterwards it's been chopped up with '\0's, and only 1st word is seen.
>
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> ---
>  lib/dynamic_debug.c |   66 ++++++++++++++++++++-------------------------------
>  1 files changed, 26 insertions(+), 40 deletions(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index af6f1ae..a7161db 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -157,18 +157,17 @@ static void ddebug_change(const struct ddebug_query *query,
>                                dp->enabled = 1;
>                        else
>                                dp->enabled = 0;
> -                       if (verbose)
> -                               pr_info("changed %s:%d [%s]%s %s\n",
> -                                       dp->filename, dp->lineno,
> -                                       dt->mod_name, dp->function,
> -                                       ddebug_describe_flags(dp, flagbuf,
> -                                                       sizeof(flagbuf)));
> +                       pr_debug("changed %s:%d [%s]%s %s\n",
> +                               dp->filename, dp->lineno,
> +                               dt->mod_name, dp->function,
> +                               ddebug_describe_flags(dp, flagbuf,
> +                                               sizeof(flagbuf)));

Changing pr_info() into pr_debug() inside the dynamic_debug
implementation seems like a really bad idea to me. Such changes make
it hard to find out via source code reading whether or not there is a
risk that invoking one of these pr_debug() macros will cause infinite
recursion.

Bart.