From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8826DC4332F for ; Fri, 30 Dec 2022 23:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235424AbiL3Xww convert rfc822-to-8bit (ORCPT ); Fri, 30 Dec 2022 18:52:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235777AbiL3Xwo (ORCPT ); Fri, 30 Dec 2022 18:52:44 -0500 Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 811301E3DE for ; Fri, 30 Dec 2022 15:52:42 -0800 (PST) Received: from omf01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6D3EE120489; Fri, 30 Dec 2022 23:52:41 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA id 59E7160009; Fri, 30 Dec 2022 23:52:39 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: Ignore ETHTOOL_LINK_MODE_ enum values From: Joe Perches To: Gerhard Engleder , linux-kernel@vger.kernel.org Cc: apw@canonical.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com Date: Fri, 30 Dec 2022 15:52:38 -0800 In-Reply-To: References: <20221230195907.3959-1-gerhard@engleder-embedded.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Rspamd-Server: rspamout06 X-Rspamd-Queue-Id: 59E7160009 X-Stat-Signature: x1ap8r3swazqgk9wj8cuxtjyjnnf1kqo X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+/m6L9+OI7o7qZKALy4lC6SaCkmA5inmU= X-HE-Tag: 1672444359-641937 X-HE-Meta: U2FsdGVkX18Y7/EWZeImEsDLuzR7KY13D1g8JvL2yIF2FrJXokEsNsSIiF8dmcmhzkNG5LBx5sKvHHVXvaaxkg== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2022-12-30 at 22:15 +0100, Gerhard Engleder wrote: > On 30.12.22 21:31, Joe Perches wrote: > > On Fri, 2022-12-30 at 20:59 +0100, Gerhard Engleder wrote: > > > Since commit 4104a20646 enum values like > > > ETHTOOL_LINK_MODE_Asym_Pause_BIT are ignored. But there are other enums > > > like ETHTOOL_LINK_MODE_1000baseT_Full_BIT, which are not ignored > > > because of the not matching '1000baseT' substring. > > > > > > Extend regex to match also substrings like '1000baseT'. > > [] > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > [] > > > @@ -5780,7 +5780,7 @@ sub process { > > > if ($var !~ /^$Constant$/ && > > > $var =~ /[A-Z][a-z]|[a-z][A-Z]/ && > > > #Ignore some autogenerated defines and enum values > > > - $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/ && > > > + $var !~ /^(?:[A-Z]+_){1,5}([A-Z]{1,3}[a-z]|[0-9]+[a-z]+[A-Z])/ && > > > > NAK. > > > > This introduces an unnecessary capture group and as well it would also > > allow too many other variants that should get a warning. > > A more exact link mode regex [0-9]+base[A-Z0-9]+_(Half|Full) would > eliminate unwanted matches. Shall I extend the existing regex or > would a separate regex with comment be the better choice? Maybe $var !~ /^ETHTOOL_/