Re: [PATCH 1/4] cxgb3: Use more common logging style

From: Joe Perches
Date: Thu Feb 09 2017 - 17:39:56 EST


On Thu, 2017-02-09 at 16:34 -0600, Steve Wise wrote:
> > Subject: [PATCH 1/4] cxgb3: Use more common logging style
[]
> > -#define MOD "iw_cxgb3: "
> > -#define PDBG(fmt, args...) pr_debug(MOD fmt, ## args)
> > +#ifdef pr_fmt
> > +#undef pr_fmt
> > +#endif
>
> Is the ifdef/undef needed? I see other modules just define pr_fmt() regardless.

Yes.

Because kernel.h may be included before this file,
kernel.h creates a define for pr_fmt, so this must
be undef'd before redefining it.

The other option, done in most files, is to add
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before any #include