[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120209100612.GA4204@mwanda>
Date: Thu, 9 Feb 2012 13:06:12 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Joe Perches <joe@...ches.com>
Cc: Arend van Spriel <arend@...adcom.com>,
Andy Whitcroft <apw@...onical.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: checkpatch complaint
On Wed, Feb 08, 2012 at 03:42:14PM -0800, Joe Perches wrote:
> On Wed, 2012-02-08 at 21:51 +0100, Arend van Spriel wrote:
> > checkpatch complains on code below and I must overlook something or
> > checkpatch gives a false negative/positive/whatever:
> >
> > #define IFPTR(usb, idx) ((usb)->actconfig->interface[(idx)])
> > #define IFALTS(usb, idx) (IFPTR((usb), (idx))->altsetting[0])
> > #define IFDESC(usb, idx) IFALTS((usb), (idx)).desc
> > #define IFEPDESC(usb, idx, ep) \
> > (IFALTS((usb), (idx)).endpoint[(ep)]).desc
> >
> > checkpatch errors:
> > ERROR: Macros with complex values should be enclosed in parenthesis
> > #169: FILE: drivers/net/wireless/brcm80211/brcmfmac/usb.c:58:
> > +#define IFDESC(usb, idx) (IFALTS((usb), (idx))).desc
> >
> > ERROR: Macros with complex values should be enclosed in parenthesis
> > #170: FILE: drivers/net/wireless/brcm80211/brcmfmac/usb.c:59:
> > +#define IFEPDESC(usb, idx, ep) ((IFALTS((usb),
> > (idx))).endpoint[(ep)]).desc
> >
> > Any ideas? I tried extra parenthesis around IFALTS but that does not
> > resolve it.
>
> I think the entries should be surround by ()
> I think it's reasonable too.
>
No. That's not reasonable. The other code is:
A) perfectly fine
B) nicer to look at
We already have newbies running checkpatch.pl -f against the kernel
source and sending bogus patches that make the code uglier. I've
tried to fight back against checkpatch patches before where they
make the code worse, but it's just overwhelming. I don't like to
be the bad guy to tell newbies that they are sending bad patches
when actually the Official Kernel Checkpatch tool said they should
send it. We're causing everyone pain for no reason.
regards,
dan carpenter
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists