KernelCI discussions
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Shuah Khan <shuah@kernel.org>
Cc: "Mark Brown" <broonie@kernel.org>,
	kernelci@lists.linux.dev, kernel@collabora.com,
	"Guenter Roeck" <groeck@chromium.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 1/3] dt: dt-extract-compatibles: Handle cfile arguments in generator function
Date: Mon, 28 Aug 2023 17:13:10 -0400	[thread overview]
Message-ID: <20230828211424.2964562-2-nfraprado@collabora.com> (raw)
In-Reply-To: <20230828211424.2964562-1-nfraprado@collabora.com>

Move the handling of the cfile arguments to a separate generator
function to avoid redundancy.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---

(no changes since v2)

Changes in v2:
- Added this commit

 scripts/dtc/dt-extract-compatibles | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/scripts/dtc/dt-extract-compatibles b/scripts/dtc/dt-extract-compatibles
index 9df9f1face83..2b6d228602e8 100755
--- a/scripts/dtc/dt-extract-compatibles
+++ b/scripts/dtc/dt-extract-compatibles
@@ -49,6 +49,14 @@ def print_compat(filename, compatibles):
 	else:
 		print(*compatibles, sep='\n')
 
+def files_to_parse(path_args):
+	for f in path_args:
+		if os.path.isdir(f):
+			for filename in glob.iglob(f + "/**/*.c", recursive=True):
+				yield filename
+		else:
+			yield f
+
 show_filename = False
 
 if __name__ == "__main__":
@@ -59,11 +67,6 @@ if __name__ == "__main__":
 
 	show_filename = args.with_filename
 
-	for f in args.cfile:
-		if os.path.isdir(f):
-			for filename in glob.iglob(f + "/**/*.c", recursive=True):
-				compat_list = parse_compatibles(filename)
-				print_compat(filename, compat_list)
-		else:
-			compat_list = parse_compatibles(f)
-			print_compat(f, compat_list)
+	for f in files_to_parse(args.cfile):
+		compat_list = parse_compatibles(f)
+		print_compat(f, compat_list)
-- 
2.42.0


  reply	other threads:[~2023-08-28 21:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 21:13 [PATCH v3 0/3] Add a test to catch unprobed Devicetree devices Nícolas F. R. A. Prado
2023-08-28 21:13 ` Nícolas F. R. A. Prado [this message]
2023-08-28 21:13 ` [PATCH v3 2/3] dt: dt-extract-compatibles: Add flag for driver matching compatibles Nícolas F. R. A. Prado
2023-08-28 21:13 ` [PATCH v3 3/3] kselftest: Add new test for detecting unprobed Devicetree devices Nícolas F. R. A. Prado
2023-11-02 12:11   ` Aishwarya TCV
2023-11-02 13:45     ` Naresh Kamboju
2023-11-02 17:36       ` Mark Brown
2023-11-06 17:09         ` Rob Herring
2023-11-07 14:36           ` Mark Brown
2023-11-07 23:02           ` Nícolas F. R. A. Prado
2023-12-07 20:18   ` Mark Brown
2023-12-08 13:45     ` Nícolas F. R. A. Prado
2023-09-20 14:03 ` [PATCH v3 0/3] Add a test to catch " Nícolas F. R. A. Prado
2023-09-20 19:56   ` Rob Herring
2023-09-20 21:00     ` Nícolas F. R. A. Prado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230828211424.2964562-2-nfraprado@collabora.com \
    --to=nfraprado@collabora.com \
    --cc=andersson@kernel.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=groeck@chromium.org \
    --cc=kernel@collabora.com \
    --cc=kernelci@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox