diff mbox

[U-Boot] dtoc: Replace dot with underscore to avoid compiler errors

Message ID 20170116040908.22718-1-sjg@chromium.org
State Accepted
Commit 6b6024a3a2e0297267ad8bc0ad1dd03d6d04265a
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Jan. 16, 2017, 4:09 a.m. UTC
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.

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

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

Comments

Simon Glass Feb. 8, 2017, 5:41 p.m. UTC | #1
On 15 January 2017 at 21:09, Simon Glass <sjg@chromium.org> wrote:
> 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.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/sandbox/dts/sandbox.dts | 5 +++++
>  tools/dtoc/dtoc.py           | 1 +
>  2 files changed, 6 insertions(+)

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index e6d336f16ab..20614646f7f 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -203,6 +203,11 @@ 
 		stringarray = "one";
 	};
 
+	spl-test4 {
+		u-boot,dm-pre-reloc;
+		compatible = "sandbox,spl-test.2";
+	};
+
 	square {
 		compatible = "demo-shape";
 		colour = "blue";
diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py
index 11050b66f71..6df7b0da13a 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/dtoc.py
@@ -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