mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
scripts: get_abi.pl: don't skip what that ends with wildcards
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 <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/79ba5139643355230e3bba136b20991cfc92020f.1631957565.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
14c942578e
commit
50116aec11
1 changed files with 43 additions and 31 deletions
|
@ -589,44 +589,47 @@ sub check_undefined_symbols {
|
||||||
$found_string = 1;
|
$found_string = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($leave =~ /^\d+$/ || !defined($leaf{$leave})) {
|
||||||
|
$leave = "others";
|
||||||
|
}
|
||||||
|
|
||||||
print "--> $file\n" if ($found_string && $hint);
|
print "--> $file\n" if ($found_string && $hint);
|
||||||
if (defined($leaf{$leave})) {
|
my $what = $leaf{$leave};
|
||||||
my $what = $leaf{$leave};
|
$whats .= " $what" if (!($whats =~ m/$what/));
|
||||||
$whats .= " $what" if (!($whats =~ m/$what/));
|
|
||||||
|
|
||||||
foreach my $w (split / /, $what) {
|
foreach my $w (split / /, $what) {
|
||||||
if ($file =~ m#^$w$#) {
|
if ($file =~ m#^$w$#) {
|
||||||
$exact = 1;
|
$exact = 1;
|
||||||
last;
|
last;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
# Check for aliases
|
}
|
||||||
#
|
# Check for aliases
|
||||||
# TODO: this algorithm is O(w * n²). It can be
|
#
|
||||||
# improved in the future in order to handle it
|
# TODO: this algorithm is O(w * n²). It can be
|
||||||
# faster, by changing parse_existing_sysfs to
|
# improved in the future in order to handle it
|
||||||
# store the sysfs inside a tree, at the expense
|
# faster, by changing parse_existing_sysfs to
|
||||||
# on making the code less readable and/or using some
|
# store the sysfs inside a tree, at the expense
|
||||||
# additional perl library.
|
# on making the code less readable and/or using some
|
||||||
foreach my $a (keys %aliases) {
|
# additional perl library.
|
||||||
my $new = $aliases{$a};
|
foreach my $a (keys %aliases) {
|
||||||
my $len = length($new);
|
my $new = $aliases{$a};
|
||||||
|
my $len = length($new);
|
||||||
|
|
||||||
if (substr($file, 0, $len) eq $new) {
|
if (substr($file, 0, $len) eq $new) {
|
||||||
my $newf = $a . substr($file, $len);
|
my $newf = $a . substr($file, $len);
|
||||||
|
|
||||||
print " $newf\n" if ($found_string && $hint);
|
print " $newf\n" if ($found_string && $hint);
|
||||||
foreach my $w (split / /, $what) {
|
foreach my $w (split / /, $what) {
|
||||||
if ($newf =~ m#^$w$#) {
|
if ($newf =~ m#^$w$#) {
|
||||||
$exact = 1;
|
$exact = 1;
|
||||||
last;
|
last;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$defined++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$defined++;
|
||||||
|
|
||||||
next if ($exact);
|
next if ($exact);
|
||||||
|
|
||||||
# Ignore some sysfs nodes
|
# Ignore some sysfs nodes
|
||||||
|
@ -637,7 +640,7 @@ sub check_undefined_symbols {
|
||||||
# is not easily parseable.
|
# is not easily parseable.
|
||||||
next if ($file =~ m#/parameters/#);
|
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);
|
print "$leave at $path might be one of:$whats\n" if (!$search_string || $found_string);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -699,7 +702,16 @@ sub undefined_symbols {
|
||||||
my $leave = $what;
|
my $leave = $what;
|
||||||
$leave =~ s,.*/,,;
|
$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
|
# Escape all other symbols
|
||||||
$what =~ s/$escape_symbols/\\$1/g;
|
$what =~ s/$escape_symbols/\\$1/g;
|
||||||
|
|
Loading…
Add table
Reference in a new issue