[PATCH] teach checkpatch.pl about list_for_each

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andy Whitcroft <apw@...>
Cc: <linux-kernel@...>
Date: Sunday, December 2, 2007 - 8:03 am

Hi Andy,

you seem to be the last person messing around with checkpatch.pl so I'm
addressing this to you. :-)

checkpatch complains about the following:

WARNING: no space between function name and open parenthesis '('
#520: FILE: drivers/spi/spi_s3c24xx_dma.c:478:
+       list_for_each_entry (transfer, &message->transfers, transfer_list) {

which I think is a bit bogus since it actually is a for statement in
disguise.  The following patch adds list_for_each to the list of things
that look like functions that it shouldn't complain about.

By the way, what is the consensus on lines over 80 characters?
checkpatch complains about the following:

WARNING: line over 80 characters
#762: FILE: drivers/spi/spi_s3c24xx_dma.c:720:
+       printk(KERN_INFO "S3C24xx SPI DMA driver (c) 2007 Nordnav Technologies AB\n");

I can of course break this into:

        printk(KERN_INFO "S3C24xx SPI DMA driver (c) 2007 Nordnav "
	       "Technologies AB\n");

but in my opinion that becomes more even unreadable.  Would it be
possible to add a special case so that checkpatch ignores long strings
that go beyond 80 characters?  Do you think it is a good idea?

  /Christer

Index: linux-2.6.23/scripts/checkpatch.pl
===================================================================
--- linux-2.6.23.orig/scripts/checkpatch.pl
+++ linux-2.6.23/scripts/checkpatch.pl
@@ -681,7 +681,7 @@ sub process {
 
 # check for spaces between functions and their parentheses.
 		if ($line =~ /($Ident)\s+\(/ &&
-		    $1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/ &&
+		    $1 !~ /^(?:if|for|while|switch|list_for_each.*|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/ &&
 		    $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) {
 			WARN("no space between function name and open parenthesis '('\n" . $herecurr);
 		}
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] teach checkpatch.pl about list_for_each, Christer Weinigel, (Sun Dec 2, 8:03 am)
Re: [PATCH] teach checkpatch.pl about list_for_each, Tomas Carnecky, (Thu Jan 3, 8:34 am)
Re: [PATCH] teach checkpatch.pl about list_for_each, Christer Weinigel, (Thu Jan 3, 7:10 pm)
Re: [PATCH] teach checkpatch.pl about list_for_each, pHilipp Zabel, (Thu Jan 3, 7:23 am)
Re: [PATCH] teach checkpatch.pl about list_for_each, Andy Whitcroft, (Thu Jan 3, 7:10 am)
Re: [PATCH] teach checkpatch.pl about list_for_each, Christoph Hellwig, (Thu Jan 3, 8:26 am)
Re: [PATCH] teach checkpatch.pl about list_for_each, Arnaldo Carvalho de Melo, (Thu Jan 3, 8:30 am)
Re: [PATCH] teach checkpatch.pl about list_for_each, Benny Halevy, (Thu Jan 3, 11:17 am)
Re: [PATCH] teach checkpatch.pl about list_for_each, Christer Weinigel, (Thu Jan 3, 7:12 pm)
Re: [PATCH] teach checkpatch.pl about list_for_each, Arnaldo Carvalho de Melo, (Sun Dec 2, 9:24 am)