diff options
author | Simon Glass <sjg@chromium.org> | 2020-07-07 21:32:06 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-07-17 14:32:24 +0800 |
commit | f02d0eb3fab332b94ebb98b73c3445f920a0c852 (patch) | |
tree | 315f7e29f04c7b1bc9caf0c59a6767d03f073d4e /tools/dtoc/dtb_platdata.py | |
parent | 8d7ff12e635f255afce74767a78d7584abbbaed0 (diff) |
dtoc: Support ACPI paths in of-platdata
The start of an ACPI path typically has backslashes in it. These are not
preserved during the translation from device tree to C code, since dtc
(correctly) uses the first backslash as an escape character, and dtoc
therefore leaves it out of the C string.
Fix this with special-case handling.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/dtb_platdata.py')
-rw-r--r-- | tools/dtoc/dtb_platdata.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index c148c49625..8ba8f16369 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -104,7 +104,9 @@ def get_value(ftype, value): elif ftype == fdt.TYPE_BYTE: return '%#x' % tools.ToByte(value[0]) elif ftype == fdt.TYPE_STRING: - return '"%s"' % value + # Handle evil ACPI backslashes by adding another backslash before them. + # So "\\_SB.GPO0" in the device tree effectively stays like that in C + return '"%s"' % value.replace('\\', '\\\\') elif ftype == fdt.TYPE_BOOL: return 'true' elif ftype == fdt.TYPE_INT64: |