From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3318111A for ; Mon, 28 Aug 2023 21:14:34 +0000 (UTC) Received: from notapiano.myfiosgateway.com (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id C504F6607236; Mon, 28 Aug 2023 22:14:31 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1693257273; bh=HrjOwWou5bAWqPfAighj4CIIJaWFRIbl2UCKh60cGsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SkRu8AMjrjJsiCpKZt3Ni7d7AjsF8JlblFWZRUq0e4IX99Grkm3SYeE7GgLiDiuMY Oq4K82i5vsdQes+sNT2OWAC0rnd1C/lQF3iketax1JyvtQNghfd93l2l5HWMu9V6Cb 5+CICrRcZ+nZOl1nQR1CVz1gGKb2TLCqgWCPnK9e/Z3QTkSqrk64Ayt6+gs4qL8uvP aQlZ68kztotwO+h1YyRsAMSoACl7UkTSE38qLmepHEus7OLnNS5zLq/Aq8QLXOopRZ ixtkubp4CKNshsBQjxuVm8x5RquJ6BsUobfCPxPiaHmwTZvDK0B15uGrxdRoPL/+io hlLocXHj5u3LQ== From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= To: Rob Herring , Frank Rowand , Shuah Khan Cc: Mark Brown , kernelci@lists.linux.dev, kernel@collabora.com, Guenter Roeck , Bjorn Andersson , =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] dt: dt-extract-compatibles: Add flag for driver matching compatibles Date: Mon, 28 Aug 2023 17:13:11 -0400 Message-ID: <20230828211424.2964562-3-nfraprado@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230828211424.2964562-1-nfraprado@collabora.com> References: <20230828211424.2964562-1-nfraprado@collabora.com> Precedence: bulk X-Mailing-List: kernelci@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- (no changes since v2) Changes in v2: - Added this commit scripts/dtc/dt-extract-compatibles | 57 +++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/scripts/dtc/dt-extract-compatibles b/scripts/dtc/dt-extract-compatibles index 2b6d228602e8..bd07477dd144 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'(?