Commit 87b58c6f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Greg Kroah-Hartman

scripts: get_abi.pl: fix parse logic for DT firmware

It doesn't make any sense to parse ABI entries under
/sys/firmware, as those are either specified by ACPI specs
or by Documentation/devicetree.

The current logic to ignore firmware entries is incomplete,
as it ignores just the relative name of the file, and not
its absolute name. This cause errors while parsing the
symlinks.

So, rewrite the logic for it to do a better job.

Tested with both x86 and arm64 (HiKey970) systems.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/1c806eaec96f6706db4b041bbe6a0e2519e9637e.1632750315.git.mchehab+huawei@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3a1cc06c
...@@ -635,19 +635,29 @@ my $escape_symbols = qr { ([\x01-\x08\x0e-\x1f\x21-\x29\x2b-\x2d\x3a-\x40\x7b-\x ...@@ -635,19 +635,29 @@ my $escape_symbols = qr { ([\x01-\x08\x0e-\x1f\x21-\x29\x2b-\x2d\x3a-\x40\x7b-\x
sub parse_existing_sysfs { sub parse_existing_sysfs {
my $file = $File::Find::name; my $file = $File::Find::name;
# Ignore cgroup and firmware my $mode = (lstat($file))[2];
return if ($file =~ m#^/sys/(fs/cgroup|firmware)/#); my $abs_file = abs_path($file);
# Ignore some sysfs nodes my @tmp;
return if ($file =~ m#/(sections|notes)/#); push @tmp, $file;
push @tmp, $abs_file if ($abs_file ne $file);
# Would need to check at foreach my $f(@tmp) {
# Documentation/admin-guide/kernel-parameters.txt, but this # Ignore cgroup, as this is big and has zero docs under ABI
# is not easily parseable. return if ($f =~ m#^/sys/fs/cgroup/#);
return if ($file =~ m#/parameters/#);
my $mode = (lstat($file))[2]; # Ignore firmware as it is documented elsewhere
my $abs_file = abs_path($file); # Either ACPI or under Documentation/devicetree/bindings/
return if ($f =~ m#^/sys/firmware/#);
# Ignore some sysfs nodes that aren't actually part of ABI
return if ($f =~ m#/sections|notes/#);
# Would need to check at
# Documentation/admin-guide/kernel-parameters.txt, but this
# is not easily parseable.
return if ($f =~ m#/parameters/#);
}
if (S_ISLNK($mode)) { if (S_ISLNK($mode)) {
$aliases{$file} = $abs_file; $aliases{$file} = $abs_file;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment