dtoc: Replace dot with underscore to avoid compiler errors
authorSimon Glass <sjg@chromium.org>
Mon, 16 Jan 2017 04:09:08 +0000 (21:09 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 8 Feb 2017 13:07:35 +0000 (06:07 -0700)
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
tools/dtoc/dtoc.py

index e6d336f16ab3357f25fdef2e7cf06b3245e353b5..20614646f7fa608feec1f1e207c9e705b64a7212 100644 (file)
                stringarray = "one";
        };
 
+       spl-test4 {
+               u-boot,dm-pre-reloc;
+               compatible = "sandbox,spl-test.2";
+       };
+
        square {
                compatible = "demo-shape";
                colour = "blue";
index 11050b66f71057821f0a2076fcbba0a4ad6f734e..6df7b0da13ad845bdf8bbea9902be1fcd1462acf 100755 (executable)
@@ -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