Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp621639pxh; Tue, 9 Nov 2021 16:19:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXnfH52SZg3n7Y35Rkq9/W3eGpXQgf5/x7xJW6WBipmcQLrgfW7eLj/A4gHLoAw3UX7n8H X-Received: by 2002:a05:6638:3706:: with SMTP id k6mr9078556jav.58.1636503580651; Tue, 09 Nov 2021 16:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636503580; cv=none; d=google.com; s=arc-20160816; b=kVFTxhAYJIwzSXXeFWR/rHYWirxCqehh9tU77yBznHyCtnzua3m4Kf3QXgGd/NAjlh FCDl15vPm4w1HoQXfLnqyRa/LoszCVCPl7H4V1+BAdl8AvF8ZSKvbVTGlvBhSgsWXpnJ PAVmkz5333mOT3B0JJR2ZAbbs/t0DWvpF4n0sX1+y0eIx4LXn+ejsx0nsNYXi4PYSuJz 4ianUWOe+ZPZlvLUM/bpVoy+wq9INpQRBksnPquTnMCvadM7II/LtiEqB0w80jSgkBBb ua6DgGtoD0EqnTQAjND/jQuZif2tQS1RB/BmN4xWX43zPBR3KEzSUHwjCVE8kyPKGCkg dzGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=FaAi7OXKrM8Xpd/XAEMsqmWKGRKuZrIbH866Zm27QkM=; b=WvQciMhfjJ/L/ocjMUd2NXBRbVSp03esmD5cfrI/+bWsQyEpb6YpVoGm1NBIwqRxSl fjKnsQz6YcSJj0uNOiWoNt2SeSUuIpTeMFcB8hXkP7e69n0wGmiewNQ2UrIqL0Wk8aIQ kSAe33V/ng7SXCOwJ+mR9PlP/8JATI05H9v46yp/owvBTknGfI2YlHET7BEXMUsOusuh PlwB7DqB+/a3WXcs+rSq14qA0AyGgCulvwndTDGiSHqw+Ox3981jMTr+PDScXw5cWPTU x27UaU61/gTMAAGxCFlYvQBfpYCoYo6KKhZ4JIDoW66lls5OGe1TghfeZOX1n56d0hLp 3inQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m33si2083684jam.131.2021.11.09.16.19.28; Tue, 09 Nov 2021 16:19:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244666AbhKIUtE (ORCPT + 97 others); Tue, 9 Nov 2021 15:49:04 -0500 Received: from smtprelay0012.hostedemail.com ([216.40.44.12]:35440 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235551AbhKIUtC (ORCPT ); Tue, 9 Nov 2021 15:49:02 -0500 Received: from omf20.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 95F5C7DC92; Tue, 9 Nov 2021 20:46:15 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf20.hostedemail.com (Postfix) with ESMTPA id BC36218A600; Tue, 9 Nov 2021 20:46:12 +0000 (UTC) Message-ID: <846fb6e2b711ca09b89317d0117826eafc9f5b3d.camel@perches.com> Subject: Re: [v2 10/10] iio: imu: add BNO055 I2C driver From: Joe Perches To: Randy Dunlap , andrea.merello@gmail.com, Andi Kleen Cc: Jonathan Cameron , Mauro Carvalho Chehab , linux-iio , linux-kernel , devicetree , Lars-Peter Clausen , Rob Herring , Andy Shevchenko , Matt Ranostay , Alexandru Ardelean , Jacopo Mondi , Andrea Merello Date: Tue, 09 Nov 2021 12:46:10 -0800 In-Reply-To: <4d812d76-07ca-1eb0-407d-78179628f0ba@infradead.org> References: <20210715141742.15072-1-andrea.merello@gmail.com> <20211028101840.24632-1-andrea.merello@gmail.com> <20211028101840.24632-11-andrea.merello@gmail.com> <85ef90ad-0d3a-6cb7-529f-667562b2ad71@infradead.org> <021c6fe0-8131-a4f9-9cb0-2f4771d35da1@infradead.org> <80960e445c986408e4ae9a20ac42c5b66d4d8046.camel@perches.com> <4d812d76-07ca-1eb0-407d-78179628f0ba@infradead.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.40 X-Stat-Signature: mhte6ccyh3ngy8e7zurgnsmkyiazqaoh X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: BC36218A600 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19+oTqAQeeHzJ5U+ZxRAhPKTw8pIqxtIoE= X-HE-Tag: 1636490772-693305 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-11-09 at 11:11 -0800, Randy Dunlap wrote: > On 11/9/21 10:21 AM, Joe Perches wrote: > > (cc'ing Andi Kleen, who wrote this code a decade ago) > > > Joe, can you identify why checkpatch does not detect missing Kconfig > > > help text is this simple case? > > > > Original patch here: https://lore.kernel.org/all/20211028101840.24632-11-andrea.merello@gmail.com/raw > > > > checkpatch is counting the diff header lines that follow the config entry. > > Maybe this is clearer (better?) code: > > --- > Tested-by: Randy Dunlap > Acked-by: Randy Dunlap Hey Randy/Andi. I like this patch below a bit more. It shows the Kconfig context block in the output message and documents the code a bit more. Care to test it again? --- scripts/checkpatch.pl | 53 +++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1784921c645da..0b5c0363119ff 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3480,46 +3480,49 @@ sub process { # (\b) rather than a whitespace character (\s) $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) { my $length = 0; - my $cnt = $realcnt; - my $ln = $linenr + 1; - my $f; - my $is_start = 0; - my $is_end = 0; - for (; $cnt > 0 && defined $lines[$ln - 1]; $ln++) { - $f = $lines[$ln - 1]; - $cnt-- if ($lines[$ln - 1] !~ /^-/); - $is_end = $lines[$ln - 1] =~ /^\+/; + my $ln = $linenr; + my $needs_help = 0; + my $has_help = 0; + my $herecfg = $herecurr; + while (defined $lines[$ln]) { + my $f = $lines[$ln++]; next if ($f =~ /^-/); - last if (!$file && $f =~ /^\@\@/); + last if (!$file && $f =~ /^(?:\@\@|diff )/); - if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) { - $is_start = 1; - } elsif ($lines[$ln - 1] =~ /^\+\s*(?:---)?help(?:---)?$/) { - $length = -1; + $herecfg .= $rawlines[$ln - 1] . "\n"; + if ($f =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) { + $needs_help = 1; + next; + } + if ($f =~ /^\+\s*help\s*$/) { + $has_help = 1; + next; } - $f =~ s/^.//; - $f =~ s/#.*//; - $f =~ s/^\s+//; - next if ($f =~ /^$/); + $f =~ s/^.//; # strip patch context [+ ] + $f =~ s/#.*//; # strip # directives + $f =~ s/^\s+//; # strip leading blanks + next if ($f =~ /^$/); # skip blank lines + # At the end of this Kconfig block: # This only checks context lines in the patch # and so hopefully shouldn't trigger false # positives, even though some of these are # common words in help texts - if ($f =~ /^\s*(?:config|menuconfig|choice|endchoice| - if|endif|menu|endmenu|source)\b/x) { - $is_end = 1; + if ($f =~ /^(?:config|menuconfig|choice|endchoice| + if|endif|menu|endmenu|source)\b/x) { + $herecfg =~ s/.*\n\Z//; # strip last line last; } - $length++; + $length++ if ($has_help); } - if ($is_start && $is_end && $length < $min_conf_desc_length) { + if ($needs_help && + (!$has_help || + ($has_help && $length < $min_conf_desc_length))) { WARN("CONFIG_DESCRIPTION", - "please write a paragraph that describes the config symbol fully\n" . $herecurr); + "please write a help paragraph that fully describes the config symbol\n" . $herecfg); } - #print "is_start<$is_start> is_end<$is_end> length<$length>\n"; } # check MAINTAINERS entries