]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
checkpatch: Warn if DT bindings are not in schema format
authorRob Herring <robh@kernel.org>
Thu, 12 Sep 2019 14:18:20 +0000 (15:18 +0100)
committerRob Herring <robh@kernel.org>
Fri, 11 Oct 2019 19:33:02 +0000 (14:33 -0500)
DT bindings are moving to using a json-schema based schema format
instead of freeform text. Add a checkpatch.pl check to encourage using
the schema for new bindings. It's not yet a requirement, but is
progressively being required by some maintainers.

Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Rob Herring <robh@kernel.org>
scripts/checkpatch.pl

index 6fcc66afb088083080a4b492be6af4b67d4c1430..375c1e17562cc81626f7d12f03d928be5aafa21a 100755 (executable)
@@ -2826,6 +2826,14 @@ sub process {
                             "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
                }
 
+# Check for adding new DT bindings not in schema format
+               if (!$in_commit_log &&
+                   ($line =~ /^new file mode\s*\d+\s*$/) &&
+                   ($realfile =~ m@^Documentation/devicetree/bindings/.*\.txt$@)) {
+                       WARN("DT_SCHEMA_BINDING_PATCH",
+                            "DT bindings should be in DT schema format. See: Documentation/devicetree/writing-schema.rst\n");
+               }
+
 # Check for wrappage within a valid hunk of the file
                if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
                        ERROR("CORRUPTED_PATCH",