From: Brian Norris <briannorris@chromium.org>
To: Chen-Yu Tsai <wenst@chromium.org>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
Dwaipayan Ray <dwaipayanray1@gmail.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Yingying Tang <yingying.tang@oss.qualcomm.com>
Subject: Re: [PATCH] checkpatch: Don't emit warnings for USB & PCI device DT compatible prefixes
Date: Thu, 14 May 2026 10:40:53 -0700 [thread overview]
Message-ID: <agYJJVfMBVL0KB05@google.com> (raw)
In-Reply-To: <20260514105151.2771474-1-wenst@chromium.org>
Hi Chen-Yu,
On Thu, May 14, 2026 at 06:51:50PM +0800, Chen-Yu Tsai wrote:
> 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 patterns include:
>
> - usb[0-9a-f]{1,4},[0-9a-f]{1,4}
> - pci[0-9a-f]{2,4},[0-9a-f]{1,4}
> - pciclass,[01][0-9a-f]{3}([0-9a-f]{2})?
>
> These are not real vendor prefixes. Don't emit warnings for them.
>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> This is a simplified version of what Brian Norris previously posted [1],
Wow, almost forgot about that one. Thanks for the blast from the past.
> but more comprehensive and more perl-y than what Yingying Tang posted
Is "perl-y" a good thing? :)
> [2], which only covered the second pattern.
>
> Hopefully everyone likes this version.
I like any version that eliminates obvious false positives!
But one thing that can be improved: your version still requires that the
full ID string be documented explicitly. For example, this still gives a
false warning:
$ git format-patch -1 --stdout 24af105962c8004edb9f5bf84bc587cbb30e52de | scripts/checkpatch.pl
[...]
WARNING: DT compatible string "pci0014,7a24.0" appears un-documented -- check ./Documentation/devicetree/bindings/
#234: FILE: arch/mips/boot/dts/loongson/ls7a-pch.dtsi:37:
+ compatible = "pci0014,7a24.0",
WARNING: DT compatible string "pci0014,7a14.0" appears un-documented -- check ./Documentation/devicetree/bindings/
#245: FILE: arch/mips/boot/dts/loongson/ls7a-pch.dtsi:48:
+ compatible = "pci0014,7a14.0",
[...]
The dtschema is clear that anything matching the pci pattern is OK, and
we don't need to list every possible variation in a yaml file.
> This is based on next-20260508.
>
> [1] https://lore.kernel.org/all/20190223022440.146915-1-briannorris@chromium.org/
> [2] https://lore.kernel.org/all/20251210073812.1380803-1-yingying.tang@oss.qualcomm.com/
>
> scripts/checkpatch.pl | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3727156e4cca..ccedf152acfd 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3795,6 +3795,9 @@ sub process {
>
> next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
> my $vendor = $1;
> + next if $vendor eq "pciclass";
> + next if $vendor =~ /^pci[a-f0-9]{2,4}$/;
> + next if $vendor =~ /^usb(if)?[a-f0-9]{1,4}$/;
Maybe we can move this "skip pciclass/pci/usb" stuff up a few lines?
Brian
> `grep -Eq "\\"\\^\Q$vendor\E,\\.\\*\\":" $vp_file`;
> if ( $? >> 8 ) {
> WARN("UNDOCUMENTED_DT_STRING",
> --
> 2.54.0.563.g4f69b47b94-goog
>
next prev parent reply other threads:[~2026-05-14 17:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 10:51 [PATCH] checkpatch: Don't emit warnings for USB & PCI device DT compatible prefixes Chen-Yu Tsai
2026-05-14 17:40 ` Brian Norris [this message]
2026-05-14 18:10 ` Joe Perches
2026-05-15 3:24 ` Chen-Yu Tsai
2026-05-15 19:23 ` Brian Norris
2026-05-14 18:31 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=agYJJVfMBVL0KB05@google.com \
--to=briannorris@chromium.org \
--cc=apw@canonical.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dwaipayanray1@gmail.com \
--cc=joe@perches.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=robh@kernel.org \
--cc=wenst@chromium.org \
--cc=yingying.tang@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox