Search Linux Wireless

RE: Re: [PATCH v2 2/4] mwifiex: fall back mwifiex_dbg to pr_info when adapter->dev not set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dmitry,

> -----Original Message-----
> From: Dmitry Torokhov [mailto:dtor@xxxxxxxxxx]
> Sent: 2017年4月8日 1:28
> To: Xinming Hu
> Cc: Linux Wireless; Kalle Valo; Brian Norris; Rajat Jain; Amitkumar Karwar;
> Cathy Luo; Xinming Hu
> Subject: [EXT] Re: [PATCH v2 2/4] mwifiex: fall back mwifiex_dbg to pr_info
> when adapter->dev not set
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi Xinming,
> 
> On Fri, Apr 7, 2017 at 3:51 AM, Xinming Hu <huxinming820@xxxxxxxxx>
> wrote:
> > From: Xinming Hu <huxm@xxxxxxxxxxx>
> >
> > mwifiex_dbg will do nothing before adapter->dev get assigned. several
> > logs lost in this case. it can be avoided by fall back to pr_info.
> >
> > Signed-off-by: Xinming Hu <huxm@xxxxxxxxxxx>
> > ---
> > v2: enhance adapter->dev null case.(Brain)
> > ---
> >  drivers/net/wireless/marvell/mwifiex/main.c | 17 ++++++++++++-----
> > drivers/net/wireless/marvell/mwifiex/main.h |  2 ++
> >  2 files changed, 14 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/wireless/marvell/mwifiex/main.c
> > b/drivers/net/wireless/marvell/mwifiex/main.c
> > index 98fd491..f3e772f 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/main.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/main.c
> > @@ -1749,18 +1749,25 @@ void _mwifiex_dbg(const struct
> mwifiex_adapter
> > *adapter, int mask,  {
> >         struct va_format vaf;
> >         va_list args;
> > +       char msg[MWIFIEX_LOG_LEN];
> >
> > -       if (!adapter->dev || !(adapter->debug_mask & mask))
> > +       if (!(adapter->debug_mask & mask))
> >                 return;
> >
> >         va_start(args, fmt);
> >
> > -       vaf.fmt = fmt;
> > -       vaf.va = &args;
> > -
> > -       dev_info(adapter->dev, "%pV", &vaf);
> > +       if (!adapter->dev) {
> > +               vsnprintf(msg, MWIFIEX_LOG_LEN, fmt, args);
> > +       } else {
> > +               vaf.fmt = fmt;
> > +               vaf.va = &args;
> > +               dev_info(adapter->dev, "%pV", &vaf);
> > +       }
> >
> >         va_end(args);
> > +
> > +       if (!adapter->dev)
> > +               pr_info("%s", msg);
> 
> Why not:
> 
> vaf.fmt = fmt;
> vaf.va = &args;
> 
> if (adapter->dev)
>         dev_info(adapter->dev, "%pV", &vaf); else
>         pr_info("mwifiex: %pV", &vaf);
> 

Simple change here looks better, have applied in v3.

> va_end(args);
> 
> Also, instead of static "mwifiex" prefix maybe make sure you have
> pr_fmt() set properly (I am not sure if it is set or not).
> 

Yes, we have the below define:
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Thanks
Simon

> Thanks.
> 
> --
> Dmitry




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux