[dpdk-dev] [PATCH] devtools: add long lines to the list of options

Mcnamara, John john.mcnamara at intel.com
Thu Mar 2 13:49:50 CET 2017



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Wednesday, March 1, 2017 6:39 PM
> To: Stephen Hemminger <stephen at networkplumber.org>
> Cc: Legacy, Allain (Wind River) <allain.legacy at windriver.com>;
> dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] devtools: add long lines to the list of
> options
> 
> 2017-03-01 10:08, Stephen Hemminger:
> > > --- a/devtools/checkpatches.sh
> > > +++ b/devtools/checkpatches.sh
> > > @@ -45,7 +45,7 @@ options="$options
> > > --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
> > >  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
> > >  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
> > >
> > > SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COM
> > > MENT_STYLE,\
> > > -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> > > +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
> >
> > Maybe it is time to have our own DPDK version of checkpatch which
> > knows about DPDK API's like logging functions?
> 
> It is Perl code!
> If we can have a reliable maintainer, why not.

It is not a big change. Something like the following would fix most of
the warnings:

$ git diff
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a8368d1..32981af 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -429,6 +429,7 @@ our $logFunctions = qr{(?x:
        WARN(?:_RATELIMIT|_ONCE|)|
        panic|
        MODULE_[A-Z_]+|
+       PMD_[A-Z_]+_LOG|RTE_LOG|
        seq_vprintf|seq_printf|seq_puts
 )};


However, putting the long string on its own line generally fixes the warning
while keeping the string greppable. 

Something like this (from the patch that triggered this discussion):

	if (eth_dev->data->mac_addrs == NULL) {
		PMD_DRV_LOG(ERR,
			    "Failed to allocate %d bytes needed to store MAC addresses\n",
			    ETHER_ADDR_LEN);
		return -ENOMEM;
	}

Instead of the original:

	if (eth_dev->data->mac_addrs == NULL) {
		PMD_DRV_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses\n",
			    ETHER_ADDR_LEN);
		return -ENOMEM;
	}

John




More information about the dev mailing list