dtoc: Show driver warnings once at the end
At present warnings are shown as soon as they are discovered in the
source scannner. But the function that detects them may be called multiple
times.
Collect all the warnings and show them at the end.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/dtoc/src_scan.py b/tools/dtoc/src_scan.py
index 114212c..2db9688 100644
--- a/tools/dtoc/src_scan.py
+++ b/tools/dtoc/src_scan.py
@@ -188,7 +188,6 @@
key: Driver alias declared with
DM_DRIVER_ALIAS(driver_alias, driver_name)
value: Driver name declared with U_BOOT_DRIVER(driver_name)
- _warning_disabled: true to disable warnings about driver names not found
_drivers_additional (list or str): List of additional drivers to use
during scanning
_of_match: Dict holding information about compatible strings
@@ -206,7 +205,7 @@
_phase: The phase of U-Boot that we are generating data for, e.g. 'spl'
or 'tpl'. None if not known
"""
- def __init__(self, basedir, warning_disabled, drivers_additional, phase=''):
+ def __init__(self, basedir, drivers_additional, phase=''):
"""Set up a new Scanner
"""
if not basedir:
@@ -217,7 +216,7 @@
self._drivers = {}
self._driver_aliases = {}
self._drivers_additional = drivers_additional or []
- self._warning_disabled = warning_disabled
+ self._missing_drivers = set()
self._of_match = {}
self._compat_to_driver = {}
self._uclass = {}
@@ -268,9 +267,7 @@
aliases_c.remove(compat_c)
return compat_c, aliases_c
- if not self._warning_disabled:
- print('WARNING: the driver %s was not found in the driver list'
- % (compat_list_c[0]))
+ self._missing_drivers.add(compat_list_c[0])
return compat_list_c[0], compat_list_c[1:]
@@ -578,6 +575,12 @@
self._drivers[driver.name] = driver
self._of_match.update(of_match)
+ def show_warnings(self):
+ """Show any warnings that have been collected"""
+ for name in sorted(list(self._missing_drivers)):
+ print('WARNING: the driver %s was not found in the driver list'
+ % name)
+
def scan_driver(self, fname):
"""Scan a driver file to build a list of driver names and aliases