scripts: checkpatch.pl: treat .overlay files as dts

Treat devicetree overlay files as DTS source for the purposes of
checkpatch.

Fixes #74570.

Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2024-06-20 13:24:37 +10:00 committed by Anas Nashif
commit 79f81f6eb8

View file

@ -3135,7 +3135,7 @@ sub process {
# check for DT compatible documentation
if (defined $root &&
(($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
(($realfile =~ /\.(dts|dtsi|overlay)$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
@ -3172,7 +3172,7 @@ sub process {
my $comment = "";
if ($realfile =~ /\.(h|s|S)$/) {
$comment = '/*';
} elsif ($realfile =~ /\.(c|dts|dtsi)$/) {
} elsif ($realfile =~ /\.(c|dts|dtsi|overlay)$/) {
$comment = '//';
} elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc|yaml)$/) {
$comment = '#';
@ -3214,7 +3214,7 @@ sub process {
}
# check we are in a valid source file if not then ignore this hunk
next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts|overlay)$/);
# check for using SPDX-License-Identifier on the wrong line number
if ($realline != $checklicenseline &&
@ -3295,7 +3295,7 @@ sub process {
}
# check we are in a valid source file C or perl if not then ignore this hunk
next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/);
next if ($realfile !~ /\.(h|c|pl|dtsi|dts|overlay)$/);
# at the beginning of a line any tabs must come first and anything
# more than $tabsize must use tabs, except multi-line macros which may start