checkpatch: check compatible strings in .c and .h too
authorFlorian Vaussard <florian.vaussard@epfl.ch>
Thu, 3 Apr 2014 21:49:26 +0000 (14:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Apr 2014 23:21:15 +0000 (16:21 -0700)
Look for ".compatible = "foo" strings not only in .dts files, but
in .c and .h too.

Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
Cc: Joe Perches <joe@perches.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 75b587e8ddfdcaa53ad7697359564cab617eb102..271d2f96b4071055192beca1fe54df44a3ce64e4 100755 (executable)
@@ -2074,8 +2074,10 @@ sub process {
                }
 
 # check for DT compatible documentation
-               if (defined $root && $realfile =~ /\.dts/ &&
-                   $rawline =~ /^\+\s*compatible\s*=/) {
+               if (defined $root &&
+                       (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
+                        ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
+
                        my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
 
                        foreach my $compat (@compats) {