diff mbox series

[v5,08/11] checkpatch: Add a warning for pre-schema driver model tags

Message ID 20230213155641.1208774-9-sjg@chromium.org
State Accepted
Commit 48be546b70f509d8ac02288fd5069913ec9196f3
Delegated to: Simon Glass
Headers show
Series dm: Move to new driver model schema for device tree tags | expand

Commit Message

Simon Glass Feb. 13, 2023, 3:56 p.m. UTC
Help ensure that these don't creep into development by adding a check in
checkpatch for them.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v3)

Changes in v3:
- Add a new patch to warn about pre-schema driver model tags

 scripts/checkpatch.pl           | 6 ++++++
 tools/patman/test_checkpatch.py | 6 ++++++
 2 files changed, 12 insertions(+)

Comments

Simon Glass Feb. 15, 2023, 2 a.m. UTC | #1
Help ensure that these don't creep into development by adding a check in
checkpatch for them.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v3)

Changes in v3:
- Add a new patch to warn about pre-schema driver model tags

 scripts/checkpatch.pl           | 6 ++++++
 tools/patman/test_checkpatch.py | 6 ++++++
 2 files changed, 12 insertions(+)

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ccfcbb3e125..62b764f6c38 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2680,6 +2680,12 @@  sub u_boot_line {
 		"DEVICE_PRIV_AUTO", $herecurr);
 	u_boot_struct_name($line, "per_device_plat_auto", "_plat",
 		"DEVICE_PLAT_AUTO", $herecurr);
+
+	# Avoid using the pre-schema driver model tags
+	if ($line =~ /^\+.*u-boot,dm-.*/) {
+		ERROR("PRE_SCHEMA",
+		      "Driver model schema uses 'bootph-...' tags now\n" . $herecurr);
+	}
 }
 
 sub exclude_global_initialisers {
diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py
index 4c2ab6e590e..a8bb364e42b 100644
--- a/tools/patman/test_checkpatch.py
+++ b/tools/patman/test_checkpatch.py
@@ -452,6 +452,12 @@  index 0000000..2234c87
         self.check_strl("cat");
         self.check_strl("cpy");
 
+    def test_schema(self):
+        """Check for uses of strn(cat|cpy)"""
+        pm = PatchMaker()
+        pm.add_line('arch/sandbox/dts/sandbox.dtsi', '\tu-boot,dm-pre-proper;')
+        self.check_single_message(pm, 'PRE_SCHEMA', 'error')
+
 if __name__ == "__main__":
     unittest.main()
     gitutil.RunTests()