public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Fabio Aiuto <fabioaiuto83@gmail.com>
Cc: joe@perches.com, dan.carpenter@oracle.com,
	david.laight@aculab.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h
Date: Sun, 28 Mar 2021 16:54:06 +0200	[thread overview]
Message-ID: <YGCYjiu5rv09Sm99@kroah.com> (raw)
In-Reply-To: <20210328144322.GB1450@agape.jhs>

On Sun, Mar 28, 2021 at 04:43:24PM +0200, Fabio Aiuto wrote:
> On Sun, Mar 28, 2021 at 02:08:41PM +0200, Greg KH wrote:
> > On Sat, Mar 27, 2021 at 03:24:08PM +0100, Fabio Aiuto wrote:
> > > fix the following checkpatch warning:
> > > 
> > > ERROR: Macros starting with if should be enclosed by a
> > > do - while loop to avoid possible if/else logic defects
> > > +	#define RT_PRINT_DATA(_Comp, _Level,
> > > 	_TitleString, _HexData, _HexDataLen)			\
> > > 
> > > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > > ---
> > >  drivers/staging/rtl8723bs/include/rtw_debug.h | 28 ++++++++++---------
> > >  1 file changed, 15 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/staging/rtl8723bs/include/rtw_debug.h b/drivers/staging/rtl8723bs/include/rtw_debug.h
> > > index d1c557818305..b00f8a6c4312 100644
> > > --- a/drivers/staging/rtl8723bs/include/rtw_debug.h
> > > +++ b/drivers/staging/rtl8723bs/include/rtw_debug.h
> > > @@ -236,19 +236,21 @@
> > >  #if	defined(_dbgdump)
> > >  	#undef RT_PRINT_DATA
> > >  	#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen)			\
> > > -		if (((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel))	\
> > > -		{									\
> > > -			int __i;								\
> > > -			u8 *ptr = (u8 *)_HexData;				\
> > > -			_dbgdump("%s", DRIVER_PREFIX);						\
> > > -			_dbgdump(_TitleString);						\
> > > -			for (__i = 0; __i < (int)_HexDataLen; __i++)				\
> > > -			{								\
> > > -				_dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?"  ":" ");	\
> > > -				if (((__i + 1) % 16) == 0)	_dbgdump("\n");			\
> > > -			}								\
> > > -			_dbgdump("\n");							\
> > > -		}
> > 
> > This whole nightmare needs to just be deleted and any callers of it need
> > to use the in-kernel functions for this instead.
> > 
> > thanks,
> > 
> > greg k-h
> 
> ok, will we get rid of the private debug level and components tracking as well?

Please do.

> Maybe encapsulating the built-in proposed by Joe, keeping the macro alive?

No, do not keep it alive.  Individual debugging/trace/info macros for
drivers do not make sense at all.  We have kernel-wide infrastructure
for this, it is bold for an individual driver to somehow think that they
need a "custom" solution for this instead.

Just use the normal apis, that is what they are there for.

thanks,

greg k-h

  reply	other threads:[~2021-03-28 14:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 01/20] staging: rtl8723bs: remove unused macros in include/hal_com.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 02/20] staging: rtl8723bs: put parentheses on macro with complex values " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 03/20] staging: rtl8723bs: added spaces around operators in a macro " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 04/20] staging: rtl8723bs: remove unused macros in include/hal_com_reg.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 05/20] staging: rtl8723bs: remove unused macros in include/hal_data.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 06/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 07/20] staging: rtl8723bs: add spaces around operators " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 08/20] staging: rtl8723bs: remove unused macros in include/hal_phy.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
2021-03-28  8:39   ` Joe Perches
2021-03-28 12:08   ` Greg KH
2021-03-28 14:43     ` Fabio Aiuto
2021-03-28 14:54       ` Greg KH [this message]
2021-03-27 14:24 ` [PATCH v2 10/20] staging: rtl8723bs: remove unused macro in include/rtw_pwrctrl.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 11/20] staging: rtl8723bs: remove unused field in rereg_nd_name_data struct Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 12/20] staging: rtl8723bs: remove commented code line in os_dep/ioctl_linux.c Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 13/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 14/20] staging: rtl8723bs: add spaces around operator " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 15/20] staging: rtl8723bs: remove unused macros in include/wifi.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 16/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 17/20] staging: rtl8723bs: remove macros updating unused fields in struct security_priv Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 18/20] staging: rtl8723bs: remove " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c Fabio Aiuto
2021-03-28 12:10   ` Greg KH
2021-03-28 14:23     ` Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 20/20] staging: rtl8723bs: remove unused macros in include/drv_types.c Fabio Aiuto

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=YGCYjiu5rv09Sm99@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=david.laight@aculab.com \
    --cc=fabioaiuto83@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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