From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755246AbbCaUOY (ORCPT ); Tue, 31 Mar 2015 16:14:24 -0400 Received: from smtprelay0196.hostedemail.com ([216.40.44.196]:52873 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754173AbbCaUOV (ORCPT ); Tue, 31 Mar 2015 16:14:21 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2110:2197:2198:2199:2200:2393:2559:2562:2828:3138:3139:3140:3141:3142:3354:3622:3653:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:6248:6261:7903:7974:10004:10400:10848:11026:11232:11473:11658:11914:12043:12050:12438:12517:12519:12555:12740:13019:13255:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: hen76_7ce8aceb70334 X-Filterd-Recvd-Size: 3301 Message-ID: <1427832856.18175.21.camel@perches.com> Subject: Re: [PATCH V3 linux-next] checkpatch: don't ask for asm/file.h to linux/file.h unconditionally From: Joe Perches To: Fabian Frederick Cc: linux-kernel@vger.kernel.org, Andy Whitcroft , Andrew Morton Date: Tue, 31 Mar 2015 13:14:16 -0700 In-Reply-To: <1427831785-20990-1-git-send-email-fabf@skynet.be> References: <1427831785-20990-1-git-send-email-fabf@skynet.be> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2015-03-31 at 21:56 +0200, Fabian Frederick wrote: > Currently checkpatch warns when asm/file.h is included and linux/file.h > exists. That conversion can be made when linux/file.h includes asm/file.h > which is not always the case.(See signal.h) OK by me. I would have done it directly in the if, but no real worries either way. Andrew Morton is the common path to get checkpatch patches upstream, so I cc'd him on this reply. If he doesn't pick it up within a couple/few weeks, send it again. cheers, Joe > Signed-off-by: Fabian Frederick > --- > V3: > Only grep when $root/$checkfile exists (suggested by Joe Perches) > V2: > Apply suggestions by Joe Perches: > -Remove superfluous -i in grep > -Use $root to make checkpatch callable from anywhere > -Process all include cases. > > scripts/checkpatch.pl | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index d54a814..c72e7ee 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -4242,7 +4242,8 @@ sub process { > } > } > > -#warn if is #included and is available (uses RAW line) > +# warn if is #included and is available and includes > +# itself (uses RAW line) > if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\}) { > my $file = "$1.h"; > my $checkfile = "include/linux/$file"; > @@ -4250,12 +4251,15 @@ sub process { > $realfile ne $checkfile && > $1 !~ /$allowed_asm_includes/) > { > - if ($realfile =~ m{^arch/}) { > - CHK("ARCH_INCLUDE_LINUX", > - "Consider using #include instead of \n" . $herecurr); > - } else { > - WARN("INCLUDE_LINUX", > - "Use #include instead of \n" . $herecurr); > + my $asminclude = `grep -Ec "#include\\s+" $root/$checkfile`; > + if ($asminclude > 0) { > + if ($realfile =~ m{^arch/}) { > + CHK("ARCH_INCLUDE_LINUX", > + "Consider using #include instead of \n" . $herecurr); > + } else { > + WARN("INCLUDE_LINUX", > + "Use #include instead of \n" . $herecurr); > + } > } > } > }