Skip to contentSkip to conversation

checkpatch.pl: Report an error for CONFIG_xPL_BUILD in device trees

PATCH In review Hendrik Donner 3 participants 3 messages Mar 6, 2025 – Mar 18, 2025 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch.pl: Report an error for CONFIG_xPL_BUILD in device trees

The defines for the different build phases shouldn't be used in device trees, currently they aren't even defined for device tree pre processing, resulting in build errors.

---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/checkpatch.pl +6 -0
index b8eb57f38c7..119916d4c78 100755
@@ -2692,6 +2692,12 @@ sub u_boot_line {
 		ERROR("PRE_SCHEMA",
 		      "Driver model schema uses 'bootph-...' tags now\n" . $herecurr);
 	}
+
+	# Do not allow CONFIG_xPL_BUILD in device trees
+	if ($realfile =~ /\.dtsi?$/ && $line =~ /^\+.*CONFIG_(X|S|T|V)PL_BUILD.*/) {
+		ERROR("CONFIG_xPL_BUILD",
+		      "Do not use CONFIG_xPL_BUILD in device trees\n" . $herecurr);
+	}
 }
 
 sub exclude_global_initialisers {
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Hendrik,

Quoted 11 lines · Hendrik Donner

The defines for the different build phases shouldn't be used in device trees, currently they aren't even defined for device tree pre processing, resulting in build errors.

---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

Thanks for doing this. You could also add a test to test_checkpatch.py

Quoted 20 lines
scripts/checkpatch.pl +6 -1
index b8eb57f38c7..119916d4c78 100755
@@ -2692,6 +2692,12 @@ sub u_boot_line {
                ERROR("PRE_SCHEMA",
                      "Driver model schema uses 'bootph-...' tags now\n" . $herecurr);
        }
+
+       # Do not allow CONFIG_xPL_BUILD in device trees
+       if ($realfile =~ /\.dtsi?$/ && $line =~ /^\+.*CONFIG_(X|S|T|V)PL_BUILD.*/) {
+               ERROR("CONFIG_xPL_BUILD",
+                     "Do not use CONFIG_xPL_BUILD in device trees\n" . $herecurr);
+       }
 }
 
 sub exclude_global_initialisers {
--

2.43.0

#2 lore raw
In reply to Hendrik Donner
Quoted 5 lines · Hendrik Donner

The defines for the different build phases shouldn't be used in device trees, currently they aren't even defined for device tree pre processing, resulting in build errors.

Applied to u-boot/master, thanks!

[1/1] checkpatch.pl: Report an error for CONFIG_xPL_BUILD in device trees

      commit: 69fb899133b6c374eff11b13482371bec6898a01
Signature · 1 line
Tom