lkml.org 
[lkml]   [2022]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 18/30] notifier: Show function names on notifier routines if DEBUG_NOTIFIERS is set
    On Thu, 28 Apr 2022 09:01:13 +0800
    Xiaoming Ni <nixiaoming@huawei.com> wrote:

    > > +#ifdef CONFIG_DEBUG_NOTIFIERS
    > > + {
    > > + char sym_name[KSYM_NAME_LEN];
    > > +
    > > + pr_info("notifiers: registered %s()\n",
    > > + notifier_name(n, sym_name));
    > > + }
    >
    > Duplicate Code.
    >
    > Is it better to use __func__ and %pS?
    >
    > pr_info("%s: %pS\n", __func__, n->notifier_call);
    >
    >
    > > +#endif

    Also, don't sprinkle #ifdef in C code. Instead:

    if (IS_ENABLED(CONFIG_DEBUG_NOTIFIERS))
    pr_info("notifers: regsiter %ps()\n",
    n->notifer_call);


    Or define a print macro at the start of the C file that is a nop if it is
    not defined, and use the macro.

    -- Steve

    \
     
     \ /
      Last update: 2022-05-10 19:30    [W:4.135 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site