summaryrefslogtreecommitdiff
path: root/tools/dtoc/dtb_platdata.py
diff options
context:
space:
mode:
authorWalter Lozano <walter.lozano@collabora.com>2020-06-25 01:10:08 -0300
committerSimon Glass <sjg@chromium.org>2020-07-09 22:00:29 -0600
commit361e73359615b44fe626152ba8b7870edcd9b173 (patch)
treea66d218c26d99b3b73468ed9bcd3e5a4b49df1e4 /tools/dtoc/dtb_platdata.py
parentdac8228df99d140b5204d0687599c839f3938bc8 (diff)
dtoc: add option to disable warnings
As dtoc now performs checks for valid driver names, when running dtoc tests several warnings arise as these tests don't use valid driver names. This patch adds an option to disable those warning, which is only intended for running tests. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/dtb_platdata.py')
-rw-r--r--tools/dtoc/dtb_platdata.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 1662d7ddb1..cac422a68d 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -141,6 +141,7 @@ class DtbPlatdata(object):
_valid_nodes: A list of Node object with compatible strings
_include_disabled: true to include nodes marked status = "disabled"
_outfile: The current output file (sys.stdout or a real file)
+ _warning_disabled: true to disable warnings about driver names not found
_lines: Stashed list of output lines for outputting in the future
_aliases: Dict that hold aliases for compatible strings
key: First compatible string declared in a node
@@ -151,12 +152,13 @@ class DtbPlatdata(object):
U_BOOT_DRIVER_ALIAS(driver_alias, driver_name)
value: Driver name declared with U_BOOT_DRIVER(driver_name)
"""
- def __init__(self, dtb_fname, include_disabled):
+ def __init__(self, dtb_fname, include_disabled, warning_disabled):
self._fdt = None
self._dtb_fname = dtb_fname
self._valid_nodes = None
self._include_disabled = include_disabled
self._outfile = None
+ self._warning_disabled = warning_disabled
self._lines = []
self._aliases = {}
self._drivers = []
@@ -184,8 +186,9 @@ class DtbPlatdata(object):
compat_c_old = compat_c
compat_c = self._driver_aliases.get(compat_c)
if not compat_c:
- print('WARNING: the driver %s was not found in the driver list'
- % (compat_c_old))
+ if not self._warning_disabled:
+ print('WARNING: the driver %s was not found in the driver list'
+ % (compat_c_old))
compat_c = compat_c_old
else:
aliases_c = [compat_c_old] + aliases_c
@@ -639,7 +642,7 @@ class DtbPlatdata(object):
nodes_to_output.remove(node)
-def run_steps(args, dtb_file, include_disabled, output):
+def run_steps(args, dtb_file, include_disabled, output, warning_disabled=False):
"""Run all the steps of the dtoc tool
Args:
@@ -651,7 +654,7 @@ def run_steps(args, dtb_file, include_disabled, output):
if not args:
raise ValueError('Please specify a command: struct, platdata')
- plat = DtbPlatdata(dtb_file, include_disabled)
+ plat = DtbPlatdata(dtb_file, include_disabled, warning_disabled)
plat.scan_drivers()
plat.scan_dtb()
plat.scan_tree()