[PATCH] Staging: bcm: IPv6Protocol: fixed mutiple coding style issues Fixed several coding style issues to remove most of checkpatch.pl errors and reduce the ammount of warnings.

Dan Carpenter dan.carpenter at oracle.com
Mon Apr 2 23:44:46 UTC 2012


On Mon, Apr 02, 2012 at 06:27:13PM -0400, Kevin McKinney wrote:
> On Mon, Apr 02, 2012 at 11:03:58AM +0100, max tottenham wrote:
> > On Mon, Apr 2, 2012 at 3:54 AM, Kevin McKinney <klmckinney1 at gmail.com> wrote:
> > > Hi Max,
> > >
> > > Thanks for taking the time to submit this patch, however, there are a few minor things that need to be resolved before it can be applied by Greg.
> > > Second, after I applied this patch there appears to be two errors checkpatch.pl identifies.  They are:
> > > ERROR: need consistent spacing around '*' (ctx:WxV)
> > >
> > > #3: FILE: staging/bcm/IPv6Protocol.c:3:
> > >
> > > +static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,
> > >
> > >                                                      ^
> > >
> > > ERROR: need consistent spacing around '*' (ctx:WxV)
> > >
> > > #4: FILE: staging/bcm/IPv6Protocol.c:4:
> > >
> > > +                                       IPV6Header *pstIpv6Header);
> > >
> > >                                                   ^
> > 
> > After looking around apparently this is to do with checkpatch.pl not
> > recognizing the types and thinking the the asterisk is  a
> > multiplication sign  instead of a
> > pointer(see:http://web.archiveorange.com/archive/v/1XS1vrzkSwmm4i2t22D6)
> > , as to fix it you would have something like
> > 
> > static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE * pstClassifierRule,
> >                                         IPV6Header * pstIpv6Header);
> > 
> > which conflicts with the foo *barr notation for pointers.
> Or, You can also ignore the 80 character per line limit and move these statments to one line, like this:
> 
> static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, IPV6Header *pstIpv6Header);
> 
> static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, IPV6Header *pstIpv6Header);
> 
> I typically run checkpatch.pl with a switch to turn off the 80 character check. This seems to be okay with everyone.
> 
> ./scripts/checkpatch.pl --ignore LONG_LINE -f drivers/staging/bcm/IPv6Protocol.c
>

The checkpatch.pl warning is wrong like Max says so we can ignore
it.  The warning will go away when we get rid of the typedefs.

In the end, we're going to rename all these functions and the
parameters.  It will probably look something like:

static bool match_ipv6_dest(struct classifier_rule *rule,
			    struct ipv6_header *header);

It's still not going to fit one one line and we will need to break
it up.

A bunch of the long lines in this file are caused by poor variable
names.  For example:

		for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++)

should be changed to:
		for (i = 0; i < words; i++) { ...

So if you can fix them that way, it's preferedi, but if it makes
sense to break a line up now, then go ahead.

regards,
dan carpenter




More information about the devel mailing list