mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
dt: dt-extract-compatibles: Handle cfile arguments in generator function
[ Upstream commiteb2139fc0d
] 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> Link: https://lore.kernel.org/r/20230828211424.2964562-2-nfraprado@collabora.com Signed-off-by: Rob Herring <robh@kernel.org> Stable-dep-of:8f51593cdc
("dt: dt-extract-compatibles: Don't follow symlinks when walking tree") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
cde700ceb0
commit
8a124b9e78
1 changed files with 11 additions and 8 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue