From: NĂ­colas F. R. A. Prado Date: Mon, 28 Aug 2023 21:13:11 +0000 (-0400) Subject: dt: dt-extract-compatibles: Add flag for driver matching compatibles X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=365ba0c7a73cce407bf40cdf9900b86b945d4acb;p=linux.git dt: dt-extract-compatibles: Add flag for driver matching compatibles Add a new flag, '--driver-match', to the dt-extract-compatibles script that causes it to only print out compatibles that are expected to match a driver. This output can then be used by tests to detect device probe failures. In order to filter the compatibles down to only ones that will match to a driver, the following is considered: - A compatible needs to show up in a driver's of_match_table for it to be matched to a driver - Compatibles that are used in both of_match_table and OF_DECLARE type macros can't be expected to match to a driver and so are ignored. One exception is CLK_OF_DECLARE_DRIVER, since it indicates that a driver will also later probe, so compatibles in this macro are not ignored. Signed-off-by: NĂ­colas F. R. A. Prado Link: https://lore.kernel.org/r/20230828211424.2964562-3-nfraprado@collabora.com Signed-off-by: Rob Herring --- diff --git a/scripts/dtc/dt-extract-compatibles b/scripts/dtc/dt-extract-compatibles index 2b6d228602e85..bd07477dd1440 100755 --- a/scripts/dtc/dt-extract-compatibles +++ b/scripts/dtc/dt-extract-compatibles @@ -7,11 +7,15 @@ import re import argparse -def parse_of_declare_macros(data): +def parse_of_declare_macros(data, include_driver_macros=True): """ Find all compatible strings in OF_DECLARE() style macros """ compat_list = [] # CPU_METHOD_OF_DECLARE does not have a compatible string - for m in re.finditer(r'(?