]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dtoc: Detect drivers only at the start of start of line
authorSimon Glass <sjg@chromium.org>
Wed, 3 Feb 2021 13:01:08 +0000 (06:01 -0700)
committerSimon Glass <sjg@chromium.org>
Mon, 22 Mar 2021 06:23:27 +0000 (19:23 +1300)
If a driver declaration is included in a comment, dtoc currently gets
confused. Update the parser to only consider declarations that begin at
the start of a line. Since multi-line comments begin with an asterisk,
this avoids the problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/dtoc/src_scan.py

index a2750321791a01c1afc90d5d960dd4086b062bc2..bb22b0b64ff84b0934415d38f425e97a1cc895af 100644 (file)
@@ -331,7 +331,7 @@ class Scanner:
 
         # Collect the driver name and associated Driver
         driver = None
-        re_driver = re.compile(r'UCLASS_DRIVER\((.*)\)')
+        re_driver = re.compile(r'^UCLASS_DRIVER\((.*)\)')
 
         # Collect the uclass ID, e.g. 'UCLASS_SPI'
         re_id = re.compile(r'\s*\.id\s*=\s*(UCLASS_[A-Z0-9_]+)')
@@ -427,7 +427,7 @@ class Scanner:
 
         # Collect the driver info
         driver = None
-        re_driver = re.compile(r'U_BOOT_DRIVER\((.*)\)')
+        re_driver = re.compile(r'^U_BOOT_DRIVER\((.*)\)')
 
         # Collect the uclass ID, e.g. 'UCLASS_SPI'
         re_id = re.compile(r'\s*\.id\s*=\s*(UCLASS_[A-Z0-9_]+)')