Skip to contentSkip to conversation

dtoc: Replace dot with underscore to avoid compiler errors

PATCH New Simon Glass 1 participant 2 messages Jan 16, 2017 – Feb 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dtoc: Replace dot with underscore to avoid compiler errors

If there is a '.' in a compatible string, then dtoc will produce a struct with a name containing a '.'. This won't work, so replace it with '_'.

Also add a suitable test to the sandbox device tree to catch this.

---

 arch/sandbox/dts/sandbox.dts | 5 +++++
 tools/dtoc/dtoc.py           | 1 +
 2 files changed, 6 insertions(+)
arch/sandbox/dts/sandbox.dts +5 -0
index e6d336f16ab..20614646f7f 100644
@@ -203,6 +203,11 @@
 		stringarray = "one";
 	};
 
+	spl-test4 {
+		u-boot,dm-pre-reloc;
+		compatible = "sandbox,spl-test.2";
+	};
+
 	square {
 		compatible = "demo-shape";
 		colour = "blue";
tools/dtoc/dtoc.py +1 -0
index 11050b66f71..6df7b0da13a 100755
@@ -54,6 +54,7 @@ def Conv_name_to_c(name):
     str = name.replace('@', '_at_')
     str = str.replace('-', '_')
     str = str.replace(',', '_')
+    str = str.replace('.', '_')
     str = str.replace('/', '__')
     return str
 
Signature · 1 line
2.11.0.483.g087da7b7c-goog
#1 lore raw

PATCH 1/1 dtoc: Replace dot with underscore to avoid compiler errors

Quoted 11 lines · Simon Glass

If there is a '.' in a compatible string, then dtoc will produce a struct with a name containing a '.'. This won't work, so replace it with '_'.

Also add a suitable test to the sandbox device tree to catch this.

---

 arch/sandbox/dts/sandbox.dts | 5 +++++
 tools/dtoc/dtoc.py           | 1 +
 2 files changed, 6 insertions(+)

Applied to u-boot-dm, thanks!