summaryrefslogtreecommitdiff
path: root/tools/dtoc/src_scan.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-26 06:17:25 +0300
committerSimon Glass <sjg@chromium.org>2021-04-06 07:33:19 +0300
commit0c59acef34434e47e054957108eb4fa7cef93123 (patch)
tree5bab45c29f12e205d199e58a9e5bcaf9c889737f /tools/dtoc/src_scan.py
parent5f86454b3da54586513ab83941a021cb79c383c7 (diff)
downloadu-boot-0c59acef34434e47e054957108eb4fa7cef93123.tar.xz
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>
Diffstat (limited to 'tools/dtoc/src_scan.py')
-rw-r--r--tools/dtoc/src_scan.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/dtoc/src_scan.py b/tools/dtoc/src_scan.py
index 114212cfe2..2db96884c8 100644
--- a/tools/dtoc/src_scan.py
+++ b/tools/dtoc/src_scan.py
@@ -188,7 +188,6 @@ class Scanner:
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 @@ class Scanner:
_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 @@ class Scanner:
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 @@ class Scanner:
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 @@ class Scanner:
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