Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp588066pxb; Sat, 18 Sep 2021 11:22:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwycTIy+sAKYF8wldfqTR+gLbXZqIVZc8fewhzBThbqyqwGQYkfWaUi7psD+XHvQIkO6c0v X-Received: by 2002:a05:6e02:2182:: with SMTP id j2mr12567703ila.212.1631989339399; Sat, 18 Sep 2021 11:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631989339; cv=none; d=google.com; s=arc-20160816; b=xa+O5norzZHbB3+oVMnfyelOFREKzucPd1pLIjNY98rigz3hJ203Kwnva9SEUYKgdE Wo+mJHXTXwIm5J9Y63FPmd+d408xiIHDbBYyHNPoyq40RpCl83dgUOiOLQdy0Rdq4s3U ZhBz4s0GzD0VSpPQF0N200rNikoc3Al6w1boWfCfkdi9JyP0jHDe07otPyZKglZV3F4r A6b5bo5YdU2fQp81HCtWuXyWHa/yuuVC3EZytelCpwq4USrXv9gwLNmf+dhE0gUFzB+o TaAj1HzAIwafvnD+sKzsXAbSJhOp00dBRiUS1kB/jfnlKiCLtXj5CyLASKOPTCkB6dQj +kOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wZmvzsBrjhd7d227xCUYqJbHs+s0PzNY1pP3m5kNMvs=; b=yVfmLasgs6uoVbYhD8If32scJ5DxvTZjSr2Qk2TXXSCjTPg5FDfERLMK7IU2OPdVdt 3MTPqWvhVsCW4pGybIDJnPBLWan9h7tGVVCpcO4Piseyc5Qsc/yDipkUYfdYa+9U+iCR eLK6iv+uUQ05HlXQspZCfJo0rIfThB+Up95Kn6gekTrcp578yaV4lWmzf7TOgGUlRPD1 pBozI7v2jPXRqt2LuDliFE1cAzfGGi6AX+14/tLKRGSr2YWnJvuCT3s3TFQ4I1kBGBEU YGDQO3BmkPFe890zs5sfVjRriogh5KBUTk2g04hBeTSoKDeDsP0RaMbzBW9iVm2owwZJ LwYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kgvQG6ai; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n37si1602763ioz.23.2021.09.18.11.22.07; Sat, 18 Sep 2021 11:22:19 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kgvQG6ai; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244343AbhIRJx4 (ORCPT + 99 others); Sat, 18 Sep 2021 05:53:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:54654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243710AbhIRJxq (ORCPT ); Sat, 18 Sep 2021 05:53:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E78461283; Sat, 18 Sep 2021 09:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631958742; bh=yR15p2TgWTxBiHKVm9ig5QEeA3S2VfkFPJa8dYUMMiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kgvQG6ai+2DNJ9BmZGI4cbXa8Js2LWL4tqsnEH6Zut8sexTaAiaxeVFLQbsz4mBOZ iHtChups52WOqqI4an1dKAq1IcIbHbzul1BB9VWivBuLv2+KeNiwaPqwFs3133EC3l h2mNX3jrYLJ5k0CdEqlO/ApSqRvP6Om/F+ygNmeuukgs7rHPBWXgB673lv+KRWd9LR KUfhg3IBofz1HnuxFsXJ4g+wJTdn+Gq9FEZYgmuRwvxAxK2gO6b2Z1+tGkO+urswKq qYKryqpDz5tEV5XlwcOg6L9vDo+kJ4FlrX1g2Pv3uTEj+sbodwa88NRR7qlNM8PY9a nb1xaH/3x3OnA== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mRX1A-003b16-Nb; Sat, 18 Sep 2021 11:52:20 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , "Jonathan Corbet" , linux-kernel@vger.kernel.org Subject: [PATCH v3 5/7] scripts: get_abi.pl: don't skip what that ends with wildcards Date: Sat, 18 Sep 2021 11:52:15 +0200 Message-Id: <79ba5139643355230e3bba136b20991cfc92020f.1631957565.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The search algorithm used inside check_undefined_symbols has an optimization: it seeks only whats that have the same leave name. This helps not only to speedup the search, but it also allows providing a hint about a partial match. There's a drawback, however: when "what:" finishes with a wildcard, the logic will skip the what, reporting it as "not found". Fix it by grouping the remaining cases altogether, and disabing any hints for such cases. Signed-off-by: Mauro Carvalho Chehab --- scripts/get_abi.pl | 74 +++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index f5f2f664e336..fe83f295600c 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -589,44 +589,47 @@ sub check_undefined_symbols { $found_string = 1; } + if ($leave =~ /^\d+$/ || !defined($leaf{$leave})) { + $leave = "others"; + } + print "--> $file\n" if ($found_string && $hint); - if (defined($leaf{$leave})) { - my $what = $leaf{$leave}; - $whats .= " $what" if (!($whats =~ m/$what/)); + my $what = $leaf{$leave}; + $whats .= " $what" if (!($whats =~ m/$what/)); - foreach my $w (split / /, $what) { - if ($file =~ m#^$w$#) { - $exact = 1; - last; - } + foreach my $w (split / /, $what) { + if ($file =~ m#^$w$#) { + $exact = 1; + last; } - # Check for aliases - # - # TODO: this algorithm is O(w * n²). It can be - # improved in the future in order to handle it - # faster, by changing parse_existing_sysfs to - # store the sysfs inside a tree, at the expense - # on making the code less readable and/or using some - # additional perl library. - foreach my $a (keys %aliases) { - my $new = $aliases{$a}; - my $len = length($new); + } + # Check for aliases + # + # TODO: this algorithm is O(w * n²). It can be + # improved in the future in order to handle it + # faster, by changing parse_existing_sysfs to + # store the sysfs inside a tree, at the expense + # on making the code less readable and/or using some + # additional perl library. + foreach my $a (keys %aliases) { + my $new = $aliases{$a}; + my $len = length($new); - if (substr($file, 0, $len) eq $new) { - my $newf = $a . substr($file, $len); + if (substr($file, 0, $len) eq $new) { + my $newf = $a . substr($file, $len); - print " $newf\n" if ($found_string && $hint); - foreach my $w (split / /, $what) { - if ($newf =~ m#^$w$#) { - $exact = 1; - last; - } + print " $newf\n" if ($found_string && $hint); + foreach my $w (split / /, $what) { + if ($newf =~ m#^$w$#) { + $exact = 1; + last; } } } - - $defined++; } + + $defined++; + next if ($exact); # Ignore some sysfs nodes @@ -637,7 +640,7 @@ sub check_undefined_symbols { # is not easily parseable. next if ($file =~ m#/parameters/#); - if ($hint && $defined) { + if ($hint && $defined && $leave ne "others") { print "$leave at $path might be one of:$whats\n" if (!$search_string || $found_string); next; } @@ -699,7 +702,16 @@ sub undefined_symbols { my $leave = $what; $leave =~ s,.*/,,; - next if ($leave =~ m/^\.\*/ || $leave eq ""); + # $leave is used to improve search performance at + # check_undefined_symbols, as the algorithm there can seek + # for a small number of "what". It also allows giving a + # hint about a leave with the same name somewhere else. + # However, there are a few occurences where the leave is + # either a wildcard or a number. Just group such cases + # altogether. + if ($leave =~ m/^\.\*/ || $leave eq "" || $leave =~ /^\d+$/) { + $leave = "others" ; + } # Escape all other symbols $what =~ s/$escape_symbols/\\$1/g; -- 2.31.1