Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dt: dt-check-compatible: Find struct of_device_id instances with compiler annotations

The regex search for declarations of struct of_device_id was missing
cases that had a compiler annotation such as "__maybe_unused". Improve
the regex to allow for these. Use '\S' instead of specific characters to
shorten the regex. That also finds some more compatibles using '.'
characters.

Unfortunately, these changes add ~400 more compatibles without a
schema.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230804190130.1936566-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>

+2 -2
+2 -2
scripts/dtc/dt-extract-compatibles
··· 25 25 def parse_of_device_id(data): 26 26 """ Find all compatible strings in of_device_id structs """ 27 27 compat_list = [] 28 - for m in re.finditer(r'of_device_id\s+[a-zA-Z0-9_]+\[\]\s*=\s*({.*?);', data): 29 - compat_list += re.findall(r'\.compatible\s+=\s+"([a-zA-Z0-9_\-,]+)"', m[1]) 28 + for m in re.finditer(r'of_device_id(\s+\S+)?\s+\S+\[\](\s+\S+)?\s*=\s*({.*?);', data): 29 + compat_list += re.findall(r'\.compatible\s+=\s+"(\S+)"', m[3]) 30 30 31 31 return compat_list 32 32