Skip to contentSkip to conversation

checkpatch: fix wildcard DT compatible string checking

PATCH In review Rob Herring 2 participants 2 messages Apr 10, 2014 – May 19, 2014 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 checkpatch: fix wildcard DT compatible string checking

From: Rob Herring <[email protected]>

We attempt to search for compatible strings which use a variable token in the documented name such as <chip> or <soc>. While this was attempted to be handled, it's utterly broken.

The desired forms of matching are:

vendor,<chip>-*
vendor,name<part#>-*

For <chip>, lower case characters and numbers are permitted. For <part#>, only numeric values are allowed.

With this change, the number of missing compatible strings reported in arch/arm/boot/dts is reduced from 1071 to 960.

Cc Florian Vaussard <[email protected]>
Cc Joe Perches <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Andrew Morton <[email protected]>

---
v2:
- drop debugging print

 scripts/checkpatch.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +4 -2
index 34eb216..62d005e 100755
@@ -2093,8 +2093,10 @@ sub process {
 
 			foreach my $compat (@compats) {
 				my $compat2 = $compat;
-				$compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/;
-				`grep -Erq "$compat|$compat2" $dt_path`;
+				$compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
+				my $compat3 = $compat;
+				$compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
+				`grep -Erq "$compat|$compat2|$compat3" $dt_path`;
 				if ( $? >> 8 ) {
 					WARN("UNDOCUMENTED_DT_STRING",
 					     "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
Signature · 1 line
1.9.1
Tested-by on v2 1/1
#1 lore raw
Quoted 17 lines · Rob Herring

From: Rob Herring <[email protected]>

We attempt to search for compatible strings which use a variable token in the documented name such as <chip> or <soc>. While this was attempted to be handled, it's utterly broken.

The desired forms of matching are:

vendor,<chip>-*
vendor,name<part#>-*

For <chip>, lower case characters and numbers are permitted. For <part#>, only numeric values are allowed.

With this change, the number of missing compatible strings reported in arch/arm/boot/dts is reduced from 1071 to 960.

Quoted 6 lines

As I came up with about the same patch while investigating why it didn't work for me:

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html