summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorChen-Yu Tsai <wenst@chromium.org>2026-07-07 15:46:27 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-08-03 21:10:12 -0700
commitd66bf04b990467a1a30d7c231b458128d2d04e9a (patch)
treed881b1f72e1ceeb6c504c5486435e6503fea4a77 /scripts/checkpatch.pl
parentf9632fe349992faa26c1ca62f595066cbfe9d46f (diff)
checkpatch: don't emit warnings for ID-base USB & PCI DT compatibles
The USB and PCI device bindings define some compatible patterns based on device IDs that use the comma to separate vendor and product IDs. These prefix patterns include: - ^usb(if)?[0-9a-f]{1,4}, - ^pci[0-9a-f]{2,4}, - ^pciclass, These are not real vendor prefixes. Don't emit warnings for them. Instead just skip over the DT compatible check altogether, and leave the real check to the DT validator. This avoids false positive warnings about undocumented DT vendor prefixes and compatibles. Note that the script mostly only checks the first compatible string of each node, as it processes the source file line-by-line, and the check only matches on the line with 'compatible = "..."'. Otherwise there would be more warnings from arch/mips/boot/dts/loongson/ls7a-pch.dtsi since that file also includes compatibles like "pciclass0c0310" and "pciclass0c03" which are not accepted either. "pci0014,7a24.0" is not valid either, but this patch leaves the real check to the DT validator. Link: https://lore.kernel.org/20260707074629.3132930-1-wenst@chromium.org Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org> Tested-by: Brian Norris <briannorris@chromium.org> Cc: Andy Whitcroft <apw@canonical.com> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> Cc: Joe Perches <joe@perches.com> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com> Cc: Rob Herring <robh@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2b7a42bbdd94..7a846a3ea127 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3781,6 +3781,12 @@ sub process {
my $vp_file = $dt_path . "vendor-prefixes.yaml";
foreach my $compat (@compats) {
+ # Skip ID-based PCI and USB compatible patterns.
+ # DT validation will check them properly.
+ next if $compat =~ /^pciclass,/;
+ next if $compat =~ /^pci[a-f0-9]{2,4},/;
+ next if $compat =~ /^usb(if)?[a-f0-9]{1,4},/;
+
my $compat2 = $compat;
$compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
my $compat3 = $compat;