All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
Cc: Julia.Lawall@lip6.fr, pablo@netfilter.org,
	devel@driverdev.osuosl.org, outreachy-kernel@googlegroups.com
Subject: Re: [PATCH v2] staging: wlan-ng: Remove unnecessary parentheses
Date: Wed, 18 Oct 2017 16:55:22 +0200	[thread overview]
Message-ID: <20171018145522.GA27138@kroah.com> (raw)
In-Reply-To: <20171018144609.GA1055@ubuntu-server-1604>

On Wed, Oct 18, 2017 at 10:46:09AM -0400, Frank A. Cancio Bello wrote:
> On Wed, Oct 18, 2017 at 04:17:04PM +0200, Greg KH wrote:
> > On Mon, Oct 16, 2017 at 09:48:21PM -0400, Frank A. Cancio Bello wrote:
> > > Remove unnecessary parentheses to comply with preferred coding style for
> > > the linux kernel and avoid the following checkpatch's message:
> > > 'CHECK: Unnecessary parentheses around'
> > > 
> > > Credits to checkpatch.
> > > 
> > > Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
> > > ---
> > > Changes in v2:
> > > 	* I rewrote the log message to improve the style taking in consideration Julia's suggestions.
> > > 	* I merged in this patch similars changes that initially were in theirs own patch. I will reply that other patch email thread, saying to discard it, to avoid confussion.
> > > 
> > >  drivers/staging/wlan-ng/cfg80211.c     | 10 +++++-----
> > >  drivers/staging/wlan-ng/hfa384x_usb.c  | 18 +++++++++---------
> > >  drivers/staging/wlan-ng/p80211conv.c   |  6 +++---
> > >  drivers/staging/wlan-ng/p80211netdev.c |  4 ++--
> > >  drivers/staging/wlan-ng/p80211req.c    |  2 +-
> > >  drivers/staging/wlan-ng/prism2fw.c     | 23 +++++++++++------------
> > >  drivers/staging/wlan-ng/prism2mgmt.c   | 29 ++++++++++++++---------------
> > >  drivers/staging/wlan-ng/prism2sta.c    |  4 ++--
> > >  8 files changed, 47 insertions(+), 49 deletions(-)
> > > 
> > > diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
> > > index 178f6f5..03279aa 100644
> > > --- a/drivers/staging/wlan-ng/cfg80211.c
> > > +++ b/drivers/staging/wlan-ng/cfg80211.c
> > > @@ -265,7 +265,7 @@ static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
> > >  
> > >  	memset(sinfo, 0, sizeof(*sinfo));
> > >  
> > > -	if (!wlandev || (wlandev->msdstate != WLAN_MSD_RUNNING))
> > > +	if (!wlandev || wlandev->msdstate != WLAN_MSD_RUNNING)
> > 
> > That's not "unnecessary" as now I need to go look up or try to remember
> > the order of operations for != and || :(
> > 
> 
> Thanks for your help Greg!
> I agreed with you. I'm a newbie still learning the kernel code style.
> When I run:
>   perl scripts/checkpatch.pl -f drivers/staging/wlan-ng/cfg80211.c
> I get the following warning:
> 
> CHECK: Unnecessary parentheses around 'wlandev->msdstate != WLAN_MSD_RUNNING'
> #268: FILE: drivers/staging/wlan-ng/cfg80211.c:268:
> +       if (!wlandev || (wlandev->msdstate != WLAN_MSD_RUNNING))
> 
> and that is why I proposed the change.

checkpatch is a hint, it's not always correct :)

> > Please don't make things such that it is harder to read for a
> > programmer.
> > 
> 
> Is OK to say that in cases of newline after the || parentheses could be 
> removed without affect code clarity?
> 
> Would you accept a v3 of this patch that just removes parentheses in those
> cases? Or you prefer to drop this patch?

I've already dropped this, if you have other changes in this patch that
do not make things harder to understand, please fix up and resend.

thanks,

greg k-h


  reply	other threads:[~2017-10-18 14:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 18:26 [PATCH] staging: wlan-ng: Remove unnecessary parentheses Frank A. Cancio Bello
2017-10-16 20:18 ` [Outreachy kernel] " Julia Lawall
2017-10-16 21:45   ` Frank A. Cancio Bello
2017-10-16 21:47     ` Julia Lawall
2017-10-17  1:48 ` [PATCH v2] " Frank A. Cancio Bello
2017-10-18 14:17   ` Greg KH
2017-10-18 14:46     ` Frank A. Cancio Bello
2017-10-18 14:55       ` Greg KH [this message]
2017-10-18 15:48         ` [PATCH v3] " Frank A. Cancio Bello
2017-10-18 21:40           ` Tobin C. Harding
2017-10-18 22:50             ` Frank A. Cancio Bello
2017-10-19  1:38               ` Tobin C. Harding
2017-10-19 11:02   ` [PATCH v2] " kbuild test robot
2017-10-18 10:45 ` [PATCH] " kbuild test robot

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=20171018145522.GA27138@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=devel@driverdev.osuosl.org \
    --cc=frank@generalsoftwareinc.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pablo@netfilter.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.