linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Potter <phil@philpotter.co.uk>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	insafonov@gmail.com, linux@roeck-us.net, straube.linux@gmail.com,
	liushixin2@huawei.com, gustavoars@kernel.org,
	christophe.jaillet@wanadoo.fr, yepeilin.cs@gmail.com,
	martin@kaiser.cx, simon.fodin@gmail.com, romain.perier@gmail.com,
	apais@linux.microsoft.com, mh12gx2825@gmail.com
Subject: Re: [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c
Date: Mon, 14 Jun 2021 22:29:44 +0100	[thread overview]
Message-ID: <YMfKSCtA86Rg5e6O@equinox> (raw)
In-Reply-To: <20210614065019.GK1955@kadam>

On Mon, Jun 14, 2021 at 09:50:19AM +0300, Dan Carpenter wrote:
> On Sun, Jun 13, 2021 at 11:41:45PM +0100, Phillip Potter wrote:
> > Convert all calls to the DBG_88E macro in core/rtw_efuse.c into
> > netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
> > debug messages can be controlled more precisely by just using debugfs.
> > It is important to keep these messages still, as they are displayable
> > via a kernel module parameter when using DBG_88E.
> > 
> 
> These are not 100% dead code like the previous debug macros but I think
> we are better off doing another mass delete.
> 
> > Also modify efuse_phymap_to_logical function signature to pass through
> > a struct net_device pointer, so that we can use it to call netdev_dbg
> > in this function too.
> > 
> > Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> > ---
> >  drivers/staging/rtl8188eu/core/rtw_efuse.c | 27 ++++++++++++++--------
> >  1 file changed, 17 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> > index 9bb3ec0cd62f..019796c0f1af 100644
> > --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
> > +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
> > @@ -72,7 +72,7 @@ static void efuse_power_switch(struct adapter *pAdapter, u8 write, u8 pwrstate)
> >  }
> >  
> >  static void
> > -efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
> > +efuse_phymap_to_logical(struct net_device *dev, u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf)
> >  {
> >  	u8 *efuseTbl = NULL;
> >  	u8 rtemp8;
> > @@ -92,7 +92,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
> >  		      sizeof(void *) + EFUSE_MAX_WORD_UNIT * sizeof(u16),
> >  		      GFP_KERNEL);
> >  	if (!tmp) {
> > -		DBG_88E("%s: alloc eFuseWord fail!\n", __func__);
> > +		netdev_dbg(dev, "alloc eFuseWord fail!\n");
> 
> This print is pointless and wrong.  It shouldn't be a debug printk it
> should be an error message.  But kcalloc() already has an error message
> built in and adding an additional warning here will lead to a checkpatch
> complaint.
> 
> >  		goto eFuseWord_failed;
> >  	}
> >  	for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
> > @@ -113,7 +113,9 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8  *pbuf)
> >  		efuse_utilized++;
> >  		eFuse_Addr++;
> >  	} else {
> > -		DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data =%x\n", eFuse_Addr, rtemp8);
> > +		netdev_dbg(dev,
> > +			   "EFUSE is empty efuse_Addr-%d efuse_data =%x\n",
> > +			   eFuse_Addr, rtemp8);
> 
> I don't know enough to say if this is useful or not, but I'm really
> skeptical.
> 
> >  		goto exit;
> >  	}
> >  
> > @@ -220,7 +222,7 @@ static void efuse_read_phymap_from_txpktbuf(
> >  	if (bcnhead < 0) /* if not valid */
> >  		bcnhead = usb_read8(adapter, REG_TDECTRL + 1);
> >  
> > -	DBG_88E("%s bcnhead:%d\n", __func__, bcnhead);
> > +	netdev_dbg(adapter->pnetdev, "bcnhead:%d\n", bcnhead);
> 
> The only caller is efuse_ReadEFuse() and bcnhead is always zero.  All
> these checks and debug code can be deleted.
> 
> >  
> >  	usb_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
> >  
> > @@ -232,8 +234,10 @@ static void efuse_read_phymap_from_txpktbuf(
> >  		usb_write8(adapter, REG_TXPKTBUF_DBG, 0);
> >  		start = jiffies;
> >  		while (!(reg_0x143 = usb_read8(adapter, REG_TXPKTBUF_DBG)) &&
> > -		       jiffies_to_msecs(jiffies - start) < 1000) {
> > -			DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, usb_read8(adapter, 0x106));
> > +			jiffies_to_msecs(jiffies - start) < 1000) {
> > +			netdev_dbg(adapter->pnetdev,
> > +				   "polling reg_0x143:0x%02x, reg_0x106:0x%02x\n",
> > +				   reg_0x143, usb_read8(adapter, 0x106));
> 
> This is the wrong place to put debug code.  If the loop timesout it will
> print a thousand messages.  See?  So far whenever we can understand the
> code enough to say, then it's totally rubbish.
> 
> Just do a mass delete.  You won't ever regret it.
> 
> >  			usleep_range(1000, 2000);
> >  		}
> >  
> 
> regards,
> dan carpenter
> 

Dear Dan,

Thank you for this, and your other feedback. Mass delete works for me, I
shall get started :-)

Regards,
Phil

  reply	other threads:[~2021-06-14 21:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13 22:41 [PATCH 0/3] convert more DBG_88E calls and remove dead code Phillip Potter
2021-06-13 22:41 ` [PATCH 1/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_efuse.c Phillip Potter
2021-06-14  6:50   ` Dan Carpenter
2021-06-14 21:29     ` Phillip Potter [this message]
2021-06-13 22:41 ` [PATCH 2/3] staging: rtl8188eu: convert DBG_88E calls in core/rtw_xmit.c Phillip Potter
2021-06-13 22:41 ` [PATCH 3/3] staging: rtl8188eu: remove core/rtw_debug.c Phillip Potter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMfKSCtA86Rg5e6O@equinox \
    --to=phil@philpotter.co.uk \
    --cc=Larry.Finger@lwfinger.net \
    --cc=apais@linux.microsoft.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=insafonov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux@roeck-us.net \
    --cc=liushixin2@huawei.com \
    --cc=martin@kaiser.cx \
    --cc=mh12gx2825@gmail.com \
    --cc=romain.perier@gmail.com \
    --cc=simon.fodin@gmail.com \
    --cc=straube.linux@gmail.com \
    --cc=yepeilin.cs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).