lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Jun 2012 12:56:40 -0700
From:	Joe Perches <joe@...ches.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>,
	Andy Whitcroft <apw@...onical.com>
Cc:	H Hartley Sweeten <hartleys@...ionengravers.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	devel@...verdev.osuosl.org, fmhess@...rs.sourceforge.net,
	abbotti@....co.uk, gregkh@...uxfoundation.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 04/19] staging: comedi: adl_pci6208: document the
 register map of the device

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";


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ