From d66bf04b990467a1a30d7c231b458128d2d04e9a Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Tue, 7 Jul 2026 15:46:27 +0800 Subject: 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 Reviewed-by: Brian Norris Tested-by: Brian Norris Cc: Andy Whitcroft Cc: Dwaipayan Ray Cc: Joe Perches Cc: Lukas Bulwahn Cc: Rob Herring Signed-off-by: Andrew Morton --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/checkpatch.pl') 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; -- cgit From 5779e0f30fa4246748d4168a0f53298443f3744e Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Thu, 6 Aug 2026 19:00:47 -0600 Subject: checkpatch: add NOKPROBE_SYMBOL to the whitelist of lines that can occur immediately after functions It's customary for NOKPROBE_SYMBOL() macro usage to appear immediately after a function's final closing brace, but checkpatch doesn't know that yet. As a result, checkpatch --strict incorrectly flags this common kernel pattern, e.g., CHECK: Please use a blank line after function/struct/union/enum declarations 33: FILE: arch/riscv/kernel/traps.c:273: } +NOKPROBE_SYMBOL(probe_single_step_handler); Fix by adding NOKPROBE_SYMBOL to the whitelist of patterns that are cleared to appear immediately after functions. Link: https://lore.kernel.org/130be7db-6098-86a4-60fe-0c1a5d9e30ba@kernel.org Signed-off-by: Paul Walmsley Acked-by: Joe Perches Cc: Nam Cao Cc: Jisheng Zhang Signed-off-by: Andrew Morton --- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/checkpatch.pl') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7a846a3ea127..73b5e788e84e 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4154,6 +4154,7 @@ sub process { $line =~ /^\+[a-z_]*init/ || $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ || $line =~ /^\+\s*DECLARE/ || + $line =~ /^\+\s*NOKPROBE_SYMBOL/ || $line =~ /^\+\s*builtin_[\w_]*driver/ || $line =~ /^\+\s*__setup/)) { if (CHK("LINE_SPACING", -- cgit