mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Andy Whitcroft <apw@canonical.com>
Cc: H Hartley Sweeten <hartleys@visionengravers.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	devel@driverdev.osuosl.org, fmhess@users.sourceforge.net,
	abbotti@mev.co.uk, gregkh@linuxfoundation.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 04/19] staging: comedi: adl_pci6208: document the register map of the device
Date: Thu, 28 Jun 2012 12:56:40 -0700	[thread overview]
Message-ID: <1340913400.2602.19.camel@joe2Laptop> (raw)
In-Reply-To: <20120628190602.GM5333@mwanda>

On Thu, 2012-06-28 at 22:06 +0300, Dan Carpenter wrote:
> On Wed, Jun 27, 2012 at 02:56:43PM -0700, H Hartley Sweeten wrote:
> > Add defines for the register map of the device. These will be
> > used to clarify the code.
[]
> > diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c
[]
> > @@ -53,6 +53,18 @@ References:
> >   */
> >  #include "../comedidev.h"
> >  
> > +/*
> > + * PCI-6208/6216-GL register map
> > + */
> > +#define PCI6208_AO_CONTROL(x)		(0x00 + (2 * (x)))
> > +#define PCI6208_AO_STATUS		0x00
> > +#define PCI6208_AO_STATUS_DATA_SEND	(1 << 0)
> > +#define PCI6208_DIO			0x40
> > +#define PCI6208_DIO_DO_MASK		(0x0f)
> > +#define PCI6208_DIO_DO_SHIFT		(0)
> > +#define PCI6208_DIO_DI_MASK		(0xf0)
> > +#define PCI6208_DIO_DI_SHIFT		(4)
[]
> Does checkpatch.pl complain if you leave off these parenthesis?

checkpatch does not complain about those.
I also think parentheses around constants aren't necessary.

I think it's useful around the shifts and necessary
with the arithmetic.

It might be useful to add a (--strict?) test for those
extra parentheses.

Maybe something like:

 scripts/checkpatch.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e5bd60f..b6b4d6b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2888,6 +2888,11 @@ sub process {
 			     "Whitepspace after \\ makes next lines useless\n" . $herecurr);
 		}
 
+		if ($line =~ /^.\s*#\s*define\s+$Ident\s+\(\s*($Constant)\s*\)\s*$/) {
+			CHK("UNNECESSARY_PARENTHESIS",
+			    "Unnecessary parenthesis in #define around constant $1\n" . $herecurr);
+		}
+
 #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
 		if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
 			my $file = "$1.h";



  reply	other threads:[~2012-06-28 19:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 21:56 H Hartley Sweeten
2012-06-28 19:06 ` Dan Carpenter
2012-06-28 19:56   ` Joe Perches [this message]
2012-06-28 19:57   ` H Hartley Sweeten

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=1340913400.2602.19.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=abbotti@mev.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fmhess@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hartleys@visionengravers.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome